How import package without .mod file?

Hello

I’m structuring my programs as Go modules. However, one of my programs needs to import the github.com/lxn/walk package. This package doesn’t have a go.mod file because it was written before Go modules were introduced. The usual go get and go get -u commands download it, but they don’t add it to my project. How can I use this package in my project? How do I import it correctly?

Hi @rizlirizlirizli, did you try this already:

  1. Import and use the package in one of your source files (the point is to have an import statement that shows go mod that your code actually uses the package)
  2. run go mod tidy