all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chris Marusich <cmmarusich@gmail.com>
To: guix-devel@gnu.org
Subject: Packaging Terraform, a Golang package
Date: Tue, 18 Dec 2018 19:10:54 -0800	[thread overview]
Message-ID: <875zvqjjnl.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 5415 bytes --]

Hi,

I'm trying to package Terraform, which is available under the Mozilla
Public License 2.0:

https://github.com/hashicorp/terraform

I'm not very familiar with how Golang programs are packaged, so I might
be missing some obvious things.  Please let me know if I am!

To begin, I thought I would first try to build it without creating a
package definition just yet.  Should be easy, right?

Clone the repo:

git clone https://github.com/hashicorp/terraform.git

Create a profile for hacking around that contains some tools that the
project seems to need:

guix package -i go make git bash grep findutils which -p .guix-profile

Make sure we're only using those dependencies:

eval "$(guix package --search-paths=exact --profile=$(realpath --no-symlinks .guix-profile))"

Enter the project directory:

cd terraform

Following the docs, run "make tools" to "install some required tools".
This downloads some stuff using "go get" (I'll probably have to put
those dependencies into the package definition later...):

--8<---------------cut here---------------start------------->8---
$ make tools
GO111MODULE=off go get -u golang.org/x/tools/cmd/stringer
GO111MODULE=off go get -u golang.org/x/tools/cmd/cover
GO111MODULE=off go get -u github.com/golang/mock/mockgen
--8<---------------cut here---------------end--------------->8---

Nice! Now, per the docs, we run make:

--8<---------------cut here---------------start------------->8---
$ make
==> Checking that code complies with gofmt requirements...
which: no stringer in (/home/marusich/terraform/.guix-profile/bin)
# We turn off modules for "go generate" because our downstream generate
# commands are not all ready to deal with Go modules yet, and this
# avoids downloading all of the deps that are in the vendor dir anyway.
GO111MODULE=off go generate ./...
2018/12/18 19:06:13 Generated command/internal_plugin_list.go
addrs/resource.go:256: running "stringer": exec: "stringer": executable file not found in $PATH
backend/operation_type.go:3: running "stringer": exec: "stringer": executable file not found in $PATH
backend/local/hook_count_action.go:3: running "stringer": exec: "stringer": executable file not found in $PATH
config/resource_mode.go:3: running "stringer": exec: "stringer": executable file not found in $PATH
configs/provisioner.go:121: running "stringer": exec: "stringer": executable file not found in $PATH
configs/configschema/schema.go:86: running "stringer": exec: "stringer": executable file not found in $PATH
helper/schema/resource_data_get_source.go:3: running "stringer": exec: "stringer": executable file not found in $PATH
plans/action.go:15: running "stringer": exec: "stringer": executable file not found in $PATH
plugin/mock_proto/generate.go:1: running "mockgen": exec: "mockgen": executable file not found in $PATH
states/instance_object.go:43: running "stringer": exec: "stringer": executable file not found in $PATH
states/statemgr/migrate.go:132: running "stringer": exec: "stringer": executable file not found in $PATH
terraform/context_graph_type.go:3: running "stringer": exec: "stringer": executable file not found in $PATH
tfdiags/diagnostic.go:20: running "stringer": exec: "stringer": executable file not found in $PATH
make: *** [Makefile:80: generate] Error 1
[2] marusich@garuda.local:~/terraform/terraform
$ 
--8<---------------cut here---------------end--------------->8---

It seems like it failed to build because some tools were missing from
PATH, specifically "stringer" and mockgen".  I've tried various methods
of installing these things, but I can't seem to get it working.  How do
I get "stringer" and "mockgen"?

I ran these commands, but it didn't seem to work:

--8<---------------cut here---------------start------------->8---
[2] marusich@garuda.local:~/terraform/terraform
$ go get github.com/golang/mock/gomock
go: finding github.com/hashicorp/hcl2 v0.0.0-20181215005721-253da47fd604
go: finding github.com/terraform-providers/terraform-provider-aws v1.52.0
go: finding github.com/aws/aws-sdk-go v1.16.4
go: finding github.com/zclconf/go-cty v0.0.0-20181218225846-4fe1e489ee06
go: finding github.com/boombuler/barcode v1.0.0
go: finding github.com/pquerna/otp v1.0.0
go: finding github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af
go: finding github.com/golang/mock/gomock latest
go: downloading github.com/golang/mock v1.2.0
[0] marusich@garuda.local:~/terraform/terraform
$ go install github.com/golang/mock/mockgen
[0] marusich@garuda.local:~/terraform/terraform
$ go get -u -a golang.org/x/tools/cmd/stringer
go: finding golang.org/x/tools/cmd/stringer latest
go: finding golang.org/x/tools/cmd latest
go: finding golang.org/x/tools latest
go: downloading golang.org/x/tools v0.0.0-20181218204010-d4971274fe38
[0] marusich@garuda.local:~/terraform/terraform
$ go install golang.org/x/tools/cmd/stringer
[0] marusich@garuda.local:~/terraform/terraform
$ type -P mockgen
[1] marusich@garuda.local:~/terraform/terraform
$ type -P stringer
[1] marusich@garuda.local:~/terraform/terraform
$ 
--8<---------------cut here---------------end--------------->8---

I found this information about mockgen and stringer:

https://github.com/golang/mock

https://github.com/golang/go/issues/13874

Any help would be appreciated!  I'm not sure how to proceed.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

             reply	other threads:[~2018-12-19  3:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-19  3:10 Chris Marusich [this message]
2018-12-19  7:54 ` Packaging Terraform, a Golang package Pierre Neidhardt
2018-12-19 16:17   ` Chris Marusich
2018-12-19 16:29     ` Pierre Neidhardt
2018-12-19 23:42 ` Christopher Baines
2018-12-20  9:31   ` Chris Marusich
2018-12-20  9:47     ` Pierre Neidhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zvqjjnl.fsf@gmail.com \
    --to=cmmarusich@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.