0

My GOPATH is /Users/admin/go/marketing

Running dep ensure then go build -ldflags="-s -w" -o bin/ma ma/*.go creates the following error.

../database-helpers/database-drivers.go:5:2: cannot find package "_/Users/admin/go/marketing/src/gitlab.myrepo.com/ma/database-helpers/vendor/github.com/denisenkom/go-mssqldb" in any of: /Users/admin/go/marketing/src/_/Users/admin/go/marketing/src/gitlab.myrepo.com/ma/database-helpers/vendor/github.com/denisenkom/go-mssqldb (from $GOPATH)

The directory definitely exists if you exclude the underscore and everything before.

ls /Users/admin/go/marketing/src/gitlab.myrepo.com/ma/database-helpers/vendor/github.com/denisenkom/go-mssqldb
LICENSE.txt     bulkcopy.go     doc.go          mssql.go        net.go          sspi_windows.go     tran.go
README.md       bulkcopy_sql.go     error.go        mssql_go110.go      ntlm.go         tds.go          types.go
appveyor.yml        convert.go      internal        mssql_go19.go       parser.go       token.go        uniqueidentifier.go
buf.go          decimal.go      log.go          mssql_go19pre.go    rpc.go          token_string.go

Any ideas on what I'm doing wrong?

Parris Varney
  • 11,320
  • 12
  • 47
  • 76
  • 1
    What happens if you compile the `ma` package instead of the `*.go` files: `go build ./ma`? – Martin Tournoij Sep 13 '18 at 00:24
  • 1
    An underscore usually indicates that you're not working correctly with GOPATH. Are all your packages correctly located in GOPATH? Can you build you package by it's import name? You shouldn't be building a collection of files like `ma/*.go`, you should be building a package. – JimB Sep 13 '18 at 01:37
  • @MartinTournoij @JimB building the package instead of collection by removing the `/*.go` bit seems to have done the trick. Thanks! – Parris Varney Sep 13 '18 at 12:17

0 Answers0