Quantcast
Channel: MarsHut
Viewing all articles
Browse latest Browse all 6551

-gcflags option on compiler, passing in multiple flags

$
0
0
Hi all,

I'm a new developer in Go. I am a grad student in computational science and
I'm working on creating a library for local search in Go. I know that if I
want to pass in a flag such as "race" to the compiler, i can run my Go
program with "go build -gcflags '-race' myprogram.go". But I am trying to
figure out how to pass in multiple flags. I looked at the compiler code and
couldn't find it. I'll search more, but i figure that someone here is
likely to know the quick answer.

The reason I am doing this is because I modified the compiler source code
so that I can disable errors from unused variables, which makes developing
much faster for me. I understand why unused variables are a bad idea, so I
only want this as a compiler option, therefore my need for passing in
flags. So for example, I'll run my program with "go build -gcflags
'-unused_vars_ok' myprogram.go", and it won't give me errors for unused
variables. However, I'd like to extend this so that I can also ignore
unused imported packages, but first i need to figure out how to pass in
multiple flags :)

Viewing all articles
Browse latest Browse all 6551

Trending Articles