Skip to content

Commit

Permalink
remove two unused fields from sharedCache
Browse files Browse the repository at this point in the history
ExecPath is only used within toolexecCmd, so make it a local variable.

GOMOD hasn't been used since we dropped the use of GOPRIVATE.
  • Loading branch information
mvdan authored and lu4p committed Nov 24, 2024
1 parent b38f42d commit 515358b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,7 @@ This command wraps "go %s". Below is its help:
return nil, errJustExit(1)
}

var err error
sharedCache.ExecPath, err = os.Executable()
execPath, err := os.Executable()
if err != nil {
return nil, err
}
Expand All @@ -597,7 +596,7 @@ This command wraps "go %s". Below is its help:
sharedCache.CacheDir = filepath.Join(parentDir, "garble")
}

binaryBuildID, err := buildidOf(sharedCache.ExecPath)
binaryBuildID, err := buildidOf(execPath)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -643,7 +642,7 @@ This command wraps "go %s". Below is its help:
// We can add extra flags to the end of the same -toolexec argument.
var toolexecFlag strings.Builder
toolexecFlag.WriteString("-toolexec=")
quotedExecPath, err := cmdgoQuotedJoin([]string{sharedCache.ExecPath})
quotedExecPath, err := cmdgoQuotedJoin([]string{execPath})
if err != nil {
// Can only happen if the absolute path to the garble binary contains
// both single and double quotes. Seems extremely unlikely.
Expand Down
2 changes: 0 additions & 2 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
// store it into a temporary file via gob encoding, and then reuse that file
// in each of the garble toolexec sub-processes.
type sharedCacheType struct {
ExecPath string // absolute path to the garble binary being used
ForwardBuildFlags []string // build flags fed to the original "garble ..." command

CacheDir string // absolute path to the GARBLE_CACHE directory being used
Expand Down Expand Up @@ -63,7 +62,6 @@ type sharedCacheType struct {
GOOS string // the GOOS build target
GOARCH string // the GOARCH build target

GOMOD string
GOVERSION string
GOROOT string
}
Expand Down

0 comments on commit 515358b

Please sign in to comment.