Skip to content

Commit

Permalink
Upgrade golangci-lint and address new warnings...
Browse files Browse the repository at this point in the history
...one of which was a bona fide bug!
  • Loading branch information
nickstenning committed Oct 20, 2024
1 parent 2c32102 commit 0d38e9a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ run:
linters:
disable-all: true
enable:
- copyloopvar
- errcheck
- exportloopref
- gocritic
- gosec
- govet
Expand Down
16 changes: 8 additions & 8 deletions pkg/cli/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ func push(cmd *cobra.Command, args []string) error {
err = docker.Push(imageName)
if err != nil {
if strings.Contains(err.Error(), "NAME_UNKNOWN") {
return fmt.Errorf("Unable to find existing Replicate model for %s. " +
"Go to replicate.com and create a new model before pushing." +
"\n\n" +
"If the model already exists, you may be getting this error " +
"because you're not logged in as owner of the model. " +
"This can happen if you did `sudo cog login` instead of `cog login` " +
"or `sudo cog push` instead of `cog push`, " +
"which causes Docker to use the wrong Docker credentials." +
return fmt.Errorf("Unable to find existing Replicate model for %s. "+
"Go to replicate.com and create a new model before pushing."+
"\n\n"+
"If the model already exists, you may be getting this error "+
"because you're not logged in as owner of the model. "+
"This can happen if you did `sudo cog login` instead of `cog login` "+
"or `sudo cog push` instead of `cog push`, "+
"which causes Docker to use the wrong Docker credentials.",
imageName)
}
return fmt.Errorf("Failed to push image: %w", err)
Expand Down
2 changes: 0 additions & 2 deletions pkg/config/compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ func torchGPUPackage(ver string, cuda string) (name, cpuVersion, findLinks, extr
// that is at most as high as the requested cuda version
var latest *TorchCompatibility
for _, compat := range TorchCompatibilityMatrix {
compat := compat
if !version.Matches(compat.TorchVersion(), ver) || compat.CUDA == nil {
continue
}
Expand Down Expand Up @@ -349,7 +348,6 @@ func torchvisionGPUPackage(ver, cuda string) (name, cpuVersion, findLinks, extra
// most as high as the requested cuda version
var latest *TorchCompatibility
for _, compat := range TorchCompatibilityMatrix {
compat := compat
if compat.TorchvisionVersion() != ver || compat.CUDA == nil {
continue
}
Expand Down
1 change: 0 additions & 1 deletion pkg/predict/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func NewInputs(keyVals map[string][]string) Inputs {
func NewInputsWithBaseDir(keyVals map[string]string, baseDir string) Inputs {
input := Inputs{}
for key, val := range keyVals {
val := val
if strings.HasPrefix(val, "@") {
val = filepath.Join(baseDir, val[1:])
input[key] = Input{File: &val}
Expand Down
2 changes: 1 addition & 1 deletion tools/compatgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ func main() {

rootCmd.Flags().StringVarP(&output, "output", "o", "", "Output flag (optional)")
if err := rootCmd.Execute(); err != nil {
console.Fatalf(err.Error())
console.Fatal(err.Error())
}
}

0 comments on commit 0d38e9a

Please sign in to comment.