mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
* 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>
19 lines
334 B
Go
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
|
|
}
|