Skip to content

cmd/management-console/assets: do not require specifying -tags=dev on every Go tool

Administrator requested to merge sg/nodev into master

Created by: slimsag

Prior to this change:

  • go test -short ./... -> would use the static assets, required running go generate ./... first or else the static assets in cmd/management-console/assets would not be generated yet (they are not committed since they are binary).
  • go test -short -tags=dev ./... -> would use the assets from disk (desirable when testing and developing).

If you didn't know to run go generate, or if you forgot, you would hit:

# github.com/sourcegraph/sourcegraph/cmd/management-console [github.com/sourcegraph/sourcegraph/cmd/management-console.test]
cmd/management-console/main.go:142:48: undefined: assets.Assets

After this change, the behavior is inverted. You do not need -tags=dev specified on Go tooling in order for it to be able to compile cmd/management-console. You do not hit the above error anymore.

This change is a bit tough to do because vfsgendev doesn't support a non-negated build tag, which was probably an oversight when me/Dmitri first worked on it. I've filed an issue for further discussion on this here and in the meantime used a hack to rewrite the // +build !dev directive to // +build dist.

Merge request reports

Loading