MCPcopy Index your code
hub / github.com/jetify-com/devbox / addEnvIfNotPreviouslySetByDevbox

Function addEnvIfNotPreviouslySetByDevbox

internal/devbox/envvars.go:173–179  ·  view source on GitHub ↗

addEnvIfNotPreviouslySetByDevbox adds the key-value pairs from new to existing, but only if the key was not previously set by devbox Caveat, this won't mark the values as set by devbox automatically. Instead, you need to call markEnvAsSetByDevbox when you are done setting variables. This is so you c

(existing, new map[string]string)

Source from the content-addressed store, hash-verified

171// This is so you can add variables from multiple sources (e.g. plugin, devbox.json)
172// that may build on each other (e.g. PATH=$PATH:...)
173func addEnvIfNotPreviouslySetByDevbox(existing, new map[string]string) {
174 for k, v := range new {
175 if _, alreadySet := existing[devboxSetPrefix+k]; !alreadySet {
176 existing[k] = v
177 }
178 }
179}
180
181func markEnvsAsSetByDevbox(envs ...map[string]string) {
182 for _, env := range envs {

Callers 1

computeEnvMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected