How to use build tags with go run

5,994 views
Skip to first unread message

Gert

unread,
Sep 13, 2020, 11:06:15 PM9/13/20
to golang-nuts
// +build local

This works for
go build -tags local
go test -tags local

But for some reason go run ignores the local tag?
go run . -tags local

Kurtis Rader

unread,
Sep 13, 2020, 11:12:47 PM9/13/20
to Gert, golang-nuts
I'll bet that `go run -tags local .` works. Because `go run` allows arguments after the package name that are passed to the program you have to specify build flags before the package name.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/071b3e6c-1bea-447c-9311-5a357f5a2e57n%40googlegroups.com.


--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Gert

unread,
Sep 13, 2020, 11:32:30 PM9/13/20
to golang-nuts
Thanks :) working 
Reply all
Reply to author
Forward
0 new messages