Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
golang 1.22.6
golang 1.23.2
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ BINDIR = $(PREFIX)/bin
INSTALL := install -m 0755

GO ?= go
# goreleaser v2.3.0 requires go 1.23; PR #1950 is where we're doing that. For
# now, pin to v2.2.0
GORELEASER := $(GO) run github.com/goreleaser/goreleaser/v2@v2.2.0
GORELEASER := $(GO) run github.com/goreleaser/goreleaser/v2@v2.3.2
GOIMPORTS := $(GO) run golang.org/x/tools/cmd/goimports@latest
GOLINT := $(GO) run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0

PYTHON ?= python
TOX := $(PYTHON) -Im tox
Expand Down Expand Up @@ -78,7 +78,7 @@ test: test-go test-python test-integration

.PHONY: fmt
fmt:
$(GO) run golang.org/x/tools/cmd/goimports -w -d .
$(GO) run golang.org/x/tools/cmd/goimports@latest -w -d .

.PHONY: generate
generate:
Expand All @@ -90,12 +90,12 @@ vet: pkg/dockerfile/embed/.wheel

.PHONY: check-fmt
check-fmt:
$(GO) run golang.org/x/tools/cmd/goimports -d .
@test -z $$($(GO) run golang.org/x/tools/cmd/goimports -l .)
$(GOIMPORTS) -d .
@test -z $$($(GOIMPORTS) -l .)

.PHONY: lint
lint: pkg/dockerfile/embed/.wheel check-fmt vet
$(GO) run github.com/golangci/golangci-lint/cmd/golangci-lint run ./...
$(GOLINT) run ./...
$(TOX) run --installpkg $(COG_WHEEL) -e lint,typecheck-pydantic2

.PHONY: run-docs-server
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/replicate/cog

go 1.22
go 1.23

toolchain go1.23.2

require (
github.com/anaskhan96/soup v1.2.5
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())
}
}