sourcegraph/cmd/server/shared/conf_parse.go
James McNamara 960d97bf8b
bazel: first pass at moving moving logging linting into nogo (#58910)
* First pass at moving moving logging linting into Bazel

* fixed negation operators

* Update dev/linters/logging/logging.go

Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>

* added more exceptions and refactored one or two impls

* added nogo lint pragmas to offending files

* ran configure

* reverted git-combine refactor

* ran configure

* reverted test as well

---------

Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
2024-01-02 10:07:25 -08:00

19 lines
334 B
Go

package shared
import (
"log" //nolint:logging // TODO move all logging to sourcegraph/log
"os"
)
// SetDefaultEnv will set the environment variable if it is not set.
func SetDefaultEnv(k, v string) string {
if s, ok := os.LookupEnv(k); ok {
return s
}
err := os.Setenv(k, v)
if err != nil {
log.Fatal(err)
}
return v
}