ensureGoPathLinuxBinEnvVarSet sets LINUX_GOBIN environment variable if not already set. On Linux, it defaults to $GOPATH/bin. On other systems (macOS, etc.), it defaults to $GOPATH/linux_$GOARCH/bin to support cross-compiled Linux binaries for Docker tests.
()
| 181 | // On Linux, it defaults to $GOPATH/bin. On other systems (macOS, etc.), it defaults |
| 182 | // to $GOPATH/linux_$GOARCH/bin to support cross-compiled Linux binaries for Docker tests. |
| 183 | func ensureGoPathLinuxBinEnvVarSet() { |
| 184 | if os.Getenv("LINUX_GOBIN") != "" { |
| 185 | return // already set |
| 186 | } |
| 187 | |
| 188 | gopath := os.Getenv("GOPATH") |
| 189 | if gopath == "" { |
| 190 | gopath = filepath.Join(os.Getenv("HOME"), "go") |
| 191 | } |
| 192 | |
| 193 | var gopathLinuxBin string |
| 194 | if runtime.GOOS == "linux" { |
| 195 | gopathLinuxBin = filepath.Join(gopath, "bin") |
| 196 | } else { |
| 197 | gopathLinuxBin = filepath.Join(gopath, "linux_"+runtime.GOARCH) |
| 198 | } |
| 199 | os.Setenv("LINUX_GOBIN", gopathLinuxBin) |
| 200 | } |
| 201 | |
| 202 | // ensureDgraphLinuxBinary checks if the dgraph binary exists under LINUX_GOBIN. |
| 203 | // If not found, it runs make install to build it. |
no outgoing calls
no test coverage detected