Closed abonec closed 2 years ago
I like to add a "Dummy" package like this
// +build tools
// tools is a dummy package that will be ignored for builds, but included for dependencies
package tools
import (
_ "github.com/dmarkham/enumer"
)
Then in my go.mod
file I can pin a version
github.com/dmarkham/enumer v1.5.3
Then I can run go:generate like this.
//go:generate go run github.com/dmarkham/enumer -type=From -json -transform=snake
Let me know how this works for you.
It is works, but Goland can't recognize that hack =(
Now we have two libraries with similar features but not the same. And when I add annotations like
Binary can be from any of them and result can be different. Is there any way to make sure that code will be generated only by your binary? For example, add different binary name for ensure or some other tricks that provide incompatibility with original version?