@@ -20,6 +20,7 @@ import (
2020 "slices"
2121 "strings"
2222
23+ "github.com/bep/logg"
2324 "github.com/gohugoio/hugo/common/hstrings"
2425 "github.com/gohugoio/hugo/common/hugo"
2526 "github.com/gohugoio/hugo/common/types"
@@ -63,7 +64,7 @@ var DefaultModuleConfig = Config{
6364
6465// ApplyProjectConfigDefaults applies default/missing module configuration for
6566// the main project.
66- func ApplyProjectConfigDefaults (mod Module , cfgs ... config.AllProvider ) error {
67+ func ApplyProjectConfigDefaults (logger logg. Logger , mod Module , cfgs ... config.AllProvider ) error {
6768 moda := mod .(* moduleAdapter )
6869
6970 // To bridge between old and new configuration format we need
@@ -157,7 +158,7 @@ func ApplyProjectConfigDefaults(mod Module, cfgs ...config.AllProvider) error {
157158
158159 if dir != "" {
159160 mnt := Mount {Lang : lang , Source : dir , Target : component }
160- if err := mnt .init (); err != nil {
161+ if err := mnt .init (logger ); err != nil {
161162 return fmt .Errorf ("failed to init mount %q %d: %w" , lang , i , err )
162163 }
163164 mounts = append (mounts , mnt )
@@ -173,11 +174,11 @@ func ApplyProjectConfigDefaults(mod Module, cfgs ...config.AllProvider) error {
173174}
174175
175176// DecodeConfig creates a modules Config from a given Hugo configuration.
176- func DecodeConfig (cfg config.Provider ) (Config , error ) {
177- return decodeConfig (cfg , nil )
177+ func DecodeConfig (logger logg. Logger , cfg config.Provider ) (Config , error ) {
178+ return decodeConfig (logger , cfg , nil )
178179}
179180
180- func decodeConfig (cfg config.Provider , pathReplacements map [string ]string ) (Config , error ) {
181+ func decodeConfig (logger logg. Logger , cfg config.Provider , pathReplacements map [string ]string ) (Config , error ) {
181182 c := DefaultModuleConfig
182183 c .replacementsMap = pathReplacements
183184
@@ -228,7 +229,7 @@ func decodeConfig(cfg config.Provider, pathReplacements map[string]string) (Conf
228229 for i , mnt := range c .Mounts {
229230 mnt .Source = filepath .Clean (mnt .Source )
230231 mnt .Target = filepath .Clean (mnt .Target )
231- if err := mnt .init (); err != nil {
232+ if err := mnt .init (logger ); err != nil {
232233 return c , fmt .Errorf ("failed to init mount %d: %w" , i , err )
233234 }
234235 c .Mounts [i ] = mnt
@@ -492,11 +493,13 @@ func (m Mount) ComponentAndName() (string, string) {
492493 return c , n
493494}
494495
495- func (m * Mount ) init () error {
496+ func (m * Mount ) init (logger logg. Logger ) error {
496497 if m .Lang != "" {
497498 // We moved this to a more flixeble setup in Hugo 0.148.0.
498499 m .Sites .Matrix .Languages = append (m .Sites .Matrix .Languages , m .Lang )
499- m .Lang = "" // TODO1 deprecate.
500+ m .Lang = ""
501+
502+ hugo .DeprecateWithLogger ("module.mounts.lang" , "Replaced by the more powerful 'sites.matrix' setting, see https://gohugo.io/configuration/module/#mounts" , "v0.153.0" , logger )
500503 }
501504
502505 if len (m .Sites .Matrix .Languages ) == 0 {
0 commit comments