-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Everytime I update my Go installation, I am unable to build my programs which rely on GoMySQL, e.g.
$ make
6g -o go.6 warden.go scrape.go
warden.go:22: can't find import: mysql
make: *** [go.6] Error 1
I think this problem occurs because GoMySQL installs it's target to $GOROOT/pkg/$GOOS-$GOARCH/mysql.a. The base library directory gets wiped out when running $GOROOT/src/all.bash.
I think the solution to this problem is to change the Makefile so that
TARG=githib.com/Philio/GoMySQL
and change any imports to
import "github.com/Philio/GoMySQL"
It's less visually pleasing than import "mysql", but it keeps my build from breaking every time I update the Go compiler, not to mention preventing name clashes with anyone else who might call their package "mysql".
diff --git a/Examples/query.go b/Examples/query.go index b1e6c53..d623908 100644 --- a/Examples/query.go +++ b/Examples/query.go @@ -3,7 +3,7 @@ package main import ( - "mysql" + "github.com/Philio/GoMySQL" "fmt" "os" "flag" diff --git a/Examples/reconnect.go b/Examples/reconnect.go index a798e7b..3cef7d9 100644 --- a/Examples/reconnect.go +++ b/Examples/reconnect.go @@ -4,7 +4,7 @@ package main import ( - "mysql" + "github.com/Philio/GoMySQL" "fmt" "os" "time" diff --git a/Examples/statement.go b/Examples/statement.go index c5ab2a1..593407b 100644 --- a/Examples/statement.go +++ b/Examples/statement.go @@ -3,7 +3,7 @@ package main import ( - "mysql" + "github.com/Philio/GoMySQL" "fmt" "os" "flag" diff --git a/Makefile b/Makefile index 23488ae..dba4471 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include $(GOROOT)/src/Make.inc -TARG=mysql +TARG=github.com/Philio/GoMySQL GOFILES=mysql.go mysql_const.go mysql_error.go mysql_packet.go mysql_result.go mysql_statement.go include $(GOROOT)/src/Make.pkg