chore(notice): add compiler flag to disable by default
Some checks failed
Code QL / code-ql (push) Has been cancelled
Azure Static Web Apps CI/CD / Build and Deploy (push) Has been cancelled
Release / changelog (push) Has been cancelled
Release / artifacts (push) Has been cancelled

resolves #5387
This commit is contained in:
Jan De Dobbeleer 2024-08-01 07:45:34 +02:00 committed by Jan De Dobbeleer
parent 26e277bf5f
commit 9e238adbb9
4 changed files with 23 additions and 0 deletions

View file

@ -91,5 +91,7 @@ func loadConfig(env runtime.Environment) *Config {
return Default(env, true)
}
setDisableNotice(data, &cfg)
return &cfg
}

View file

@ -0,0 +1,5 @@
//go:build !disablenotice
package config
func setDisableNotice(_ []byte, _ *Config) {}

View file

@ -0,0 +1,15 @@
//go:build disablenotice
package config
import "bytes"
func setDisableNotice(stream []byte, cfg *Config) {
if !hasKeyInByteStream(stream, "disable_notice") {
cfg.DisableNotice = true
}
}
func hasKeyInByteStream(data []byte, key string) bool {
return bytes.Contains(data, []byte(key))
}

View file

@ -75,6 +75,7 @@ func (term *Terminal) Init() {
term.sessionCache = initCache(cache.SessionFileName)
term.resolveConfigPath()
term.cmdCache = &cache.Command{
Commands: maps.NewConcurrent(),
}