This must be a simple issue. But have been trying to figure out since long.Here is what I tried to do.there is a file called wiki.go in a folder.I tried to compile using go build command in two ways1) go build wiki.gothis creates a binary named wiki in the same folder.I wanted the output to go in different folder so, I tried this2) go build wiki.go -o build/wikibut here, it throws the following error: named files must be .go files.
I was facing the same problem and this really worked.Thanks Minux.However, I do not understand the reason. Why do we have to write the output path first?
go build foo -o bar -> flags: {} args: [foo, -o, bar]
go build -o bar foo -> flags: {o: bar} args: [foo]