github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/not-internal/base/env.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package base 6 7 // EnvForDir returns a modified environment suitable for running in the given 8 // directory. 9 // The environment is the supplied base environment but with an updated $PWD, so 10 // that an os.Getwd in the child will be faster. 11 func EnvForDir(dir string, base []string) []string { 12 // Internally we only use rooted paths, so dir is rooted. 13 // Even if dir is not rooted, no harm done. 14 return append(base, "PWD="+dir) 15 }