FAQ
Some libraries have example programs in the same repo. The shiny code
has an example to demonstrate the basic shiny API, but I don't want
"go install golang.org/x/exp/shiny/..." to put a "basic" program into
my $GOPATH/bin directory. I just want to install the library packages.

Under golang.org/x and github.com/google, the convention so far, as
far as I am aware, has been to add a build tag comment like this:

// +build ignore
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go" to run it.

For example:
https://go.googlesource.com/exp/+/master/shiny/example/basic/main.go
https://github.com/golang/freetype/blob/master/example/raster/main.go

As reported at https://github.com/golang/go/issues/15062 the build
tags mean that the .go files are invisible to "go get -d ." to
explicitly get the dependencies of e.g. that basic example.

The proposal in that issue is to remove the build tags and instead mv
the example directory to _example, with a leading underscore. It is
admittedly a little ugly, but as "go help packages" says, `Directory
and file names that begin with "." or "_" are ignored by the go tool`.

I'm leaning in favor of this proposal, but it's not really specific to
x/exp/shiny, so I'm opening the bikeshed up to golang-dev for other
opinions.

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 22 | next ›
Discussion Overview
groupgolang-dev @
categoriesgo
postedApr 2, '16 at 2:42a
activeMay 2, '16 at 11:45a
posts22
users12
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase