diff options
author | Sara Op den Orth <[email protected]> | 2022-03-24 13:24:30 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-03-26 10:03:36 +0100 |
commit | 94459680ba391275ac667407627cafdab5a50d79 (patch) | |
tree | ee01acde2954fc1239c0f84d222306c7c5c04980 /source/fileInfo.go | |
parent | 9202117ba08286975c723130db60a1c69ff249a0 (diff) | |
download | hugo-94459680ba391275ac667407627cafdab5a50d79.tar.gz hugo-94459680ba391275ac667407627cafdab5a50d79.zip |
Deprecate .File.Extension
Fixes #9352
Diffstat (limited to 'source/fileInfo.go')
-rw-r--r-- | source/fileInfo.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/fileInfo.go b/source/fileInfo.go index 606b8b025..13c4495bf 100644 --- a/source/fileInfo.go +++ b/source/fileInfo.go @@ -70,11 +70,12 @@ type FileWithoutOverlap interface { // The directory is relative to the content root. Dir() string - // Extension gets the file extension, i.e "myblogpost.md" will return "md". + // Extension is an alias to Ext(). + // Deprecated: Use Ext instead. Extension() string - // Ext is an alias for Extension. - Ext() string // Hmm... Deprecate Extension + // Ext gets the file extension, i.e "myblogpost.md" will return "md". + Ext() string // LogicalName is filename and extension of the file. LogicalName() string @@ -139,7 +140,10 @@ func (fi *FileInfo) Path() string { return fi.relPath } func (fi *FileInfo) Dir() string { return fi.relDir } // Extension is an alias to Ext(). -func (fi *FileInfo) Extension() string { return fi.Ext() } +func (fi *FileInfo) Extension() string { + helpers.Deprecated(".File.Extension", "Use .File.Ext instead. ", false) + return fi.Ext() +} // Ext returns a file's extension without the leading period (ie. "md"). func (fi *FileInfo) Ext() string { return fi.ext } |