Hello experts,

I'm currently using //go:generate with external and module-internal tools. 
All external tools are documented in tools.go:

// +build tools

package main

import (
_ "github.com/golang/mock/mockgen"
_ "github.com/mjibson/esc"
)

However, the existing setup has a couple of drawbacks:

1) I cannot do go install tools.go:
tools.go:6:2: import "github.com/golang/mock/mockgen" is a program, not an 
importable package
tools.go:7:2: import "github.com/mjibson/esc" is a program, not an 
importable package

instead I need to duplicate each tool installation in the Makefile

2) The internal tools are currently not installed in invoked during build:

//go:generate go run ../cmd/tools/decorate.go ...
 
This fails during cross-build:
GOOS=linux GOARCH=arm make
go install github.com/mjibson/esc
go install github.com/golang/mock/mockgen
Generating embedded assets
go generate ./...
...
fork/exec 
/var/folders/pm/q2g_c0vn1hb414nqwdcsv4fm0000gn/T/go-build741389459/b001/exe/decorate:
 
exec format error
charger/evsewifi.go:57: running "go": exit status 1
fork/exec 
/var/folders/pm/q2g_c0vn1hb414nqwdcsv4fm0000gn/T/go-build892585922/b001/exe/decorate:
 
exec format error
meter/meter.go:16: running "go": exit status 1

I've looked at https://golang.org/cmd/go/#hdr-Build_constraints but 
couldn't find a description of best practices or even mention of +built 
tools.

Much appreciated,
Andi

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/427d5e01-37de-4814-bb4d-c87b35532e1bn%40googlegroups.com.

Reply via email to