Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Compiling Conditional Go files #1727

Closed
dadgar opened this issue Mar 15, 2016 · 1 comment
Closed

Compiling Conditional Go files #1727

dadgar opened this issue Mar 15, 2016 · 1 comment

Comments

@dadgar
Copy link

dadgar commented Mar 15, 2016

Go lets you have compile flags or suffixes on files that gate on what platform they are built on. You can see a description here.

You can force the go tool chain to compile specific OS/Architecture using environment variables:
GOOS=windows go build foo_windows.go would compile this even if you are on linux or a mac. It would be nice to incorporate this as it means when you are developing on a project that targets many operating systems, syntactic is disabled on certain files essentially. Would be cool for Neomake as well

@lcd047
Copy link
Collaborator

lcd047 commented Mar 16, 2016

If go were an usual checker, you would just set exe and fname and everything would be fine. Sadly, go makes a weird checker, at best. For the environment variable, exporting it from the relevant shell's profile should work (at least on UNIX-like OSes):

GOOS=windows
export GOOS

For the modified filename you could try something like this:

autocmd BufRead,BufNewFile *.go
    \ let b:syntastic_go_go_build_args=syntastic#util#shescape(expand('<amatch>:p:r', 1) . '_windows.go')

I can't comment on Neomake.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants