errors when installing latest v1 and v2 but only when tool present in tools.go file #1370
-
Hey, I'm updating dependencies, and among them oapi-codegen in my project. If I install the tool with these commands, it works: go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest
go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.16.2
go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@latest
go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@v2.0.0 But if I install the tool with these commands, it fails: go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen
go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen this is the error:
In the latter case, I have the following files in the project:
//go:build tools
// +build tools
package tools
import (
_ "github.com/deepmap/oapi-codegen/cmd/oapi-codegen"
}
edit: I pressed enter too fast, here's more information. As I'm writing this I'm finding more things, I'll update this as I find more things. I was going to write that I can't reproduce in previous versions, but I'm already using v1.16.2 before, and it's working well before. Maybe there's some other dependency that's causing issues |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hey! So the thing that's probably causing you the issue here is that //go:build tools
// +build tools
package tools
import (
- _ "github.com/deepmap/oapi-codegen/cmd/oapi-codegen"
+ _ "github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen"
} That should then allow you to upgrade to the v2 module in your https://gitlab.com/tanna.dev/dependency-management-data/-/merge_requests/145 is an example on one of my own projects for the upgrade. |
Beta Was this translation helpful? Give feedback.
I added to my go.mod:
and it worked like a charm !!!
Thanks