Skip to content

Commit

Permalink
ensure unresolved go-proxy version does not check online (#9)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <[email protected]>
  • Loading branch information
wagoodman authored Oct 2, 2023
1 parent 94438a5 commit 0ccc593
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tool/goproxy/version_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (v VersionResolver) ResolveVersion(want, _ string) (string, error) {
return want, nil
}

if want == latest {
if want == latest && !v.config.AllowUnresolvedVersion {
return v.findLatestVersion("")
}

Expand Down
3 changes: 2 additions & 1 deletion tool/goproxy/version_resolver_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package goproxy

import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -64,7 +65,7 @@ func TestVersionResolver_ResolveVersion(t *testing.T) {
version: "latest",
want: "latest", // this is a pass through to go-install, which supports this as input
availableVersionsFetcher: func(url string) ([]string, error) {
return []string{""}, nil
return nil, fmt.Errorf("should never be called")
},
},
}
Expand Down

0 comments on commit 0ccc593

Please sign in to comment.