From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: Packaging Terraform, a Golang package Date: Tue, 18 Dec 2018 19:10:54 -0800 Message-ID: <875zvqjjnl.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZSJX-00007h-V6 for guix-devel@gnu.org; Tue, 18 Dec 2018 22:14:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZSGD-0000xu-8f for guix-devel@gnu.org; Tue, 18 Dec 2018 22:11:04 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:33123) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZSGD-0000xP-1o for guix-devel@gnu.org; Tue, 18 Dec 2018 22:11:01 -0500 Received: by mail-pf1-x433.google.com with SMTP id c123so9131115pfb.0 for ; Tue, 18 Dec 2018 19:11:00 -0800 (PST) Received: from garuda.local (c-73-53-106-26.hsd1.wa.comcast.net. [73.53.106.26]) by smtp.gmail.com with ESMTPSA id g185sm21400346pfc.174.2018.12.18.19.10.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Dec 2018 19:10:58 -0800 (PST) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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=3Dexact --profile=3D$(realpath --no-sym= links .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...): =2D-8<---------------cut here---------------start------------->8--- $ make tools GO111MODULE=3Doff go get -u golang.org/x/tools/cmd/stringer GO111MODULE=3Doff go get -u golang.org/x/tools/cmd/cover GO111MODULE=3Doff go get -u github.com/golang/mock/mockgen =2D-8<---------------cut here---------------end--------------->8--- Nice! Now, per the docs, we run make: =2D-8<---------------cut here---------------start------------->8--- $ make =3D=3D> 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=3Doff go generate ./... 2018/12/18 19:06:13 Generated command/internal_plugin_list.go addrs/resource.go:256: running "stringer": exec: "stringer": executable fil= e not found in $PATH backend/operation_type.go:3: running "stringer": exec: "stringer": executab= le 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": executabl= e file not found in $PATH configs/configschema/schema.go:86: running "stringer": exec: "stringer": ex= ecutable file not found in $PATH helper/schema/resource_data_get_source.go:3: running "stringer": exec: "str= inger": executable file not found in $PATH plans/action.go:15: running "stringer": exec: "stringer": executable file n= ot found in $PATH plugin/mock_proto/generate.go:1: running "mockgen": exec: "mockgen": execut= able file not found in $PATH states/instance_object.go:43: running "stringer": exec: "stringer": executa= ble file not found in $PATH states/statemgr/migrate.go:132: running "stringer": exec: "stringer": execu= table file not found in $PATH terraform/context_graph_type.go:3: running "stringer": exec: "stringer": ex= ecutable 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 $=20 =2D-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: =2D-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-c2b33e843= 9af 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 $=20 =2D-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. =2D-=20 Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAlwZtr4ACgkQ3UCaFdgi Rp2nrhAAwg2f/hDoaDjKygArr6RkiN33OXbIQF2p0SLuwzvQHiNyPhbs2udKjTiP rvXiZz0+4VFo9mvDs25eL9iJIAA+Gg1FAbJa2aSMx2wRDTQcCDFm1E+avbT80jza zF2C3lEdBAqfjVGCR3gEv3sr022vCeRr2SbLxi76i4/c16YyRVM3PTp5nA4SZkIA efIl6s73t2IN+Jn2ywr04hf6DY+STXz9nfzoClWK0MQ1+4v6UmbDFMEG6/MrIYZE 5Wjo8ZbNfngA8+vEJotnkfJeVDj8Nj3cTrDcsizrKJkgVP5GQOKzC8wF4qXVT2bd 7vm4JhDSSuF8zlg3IHJpf4DhjziuT3zA/ePGOpB0swZZOPYfPZShHlKTc/hYmQsS YtB8wqjg3g8RMoL4ayazNgZLubVeqkHVRHEnaEGTdJZ7iXx0PA537xXxg+32praV nyTZgdmCErf3z1kBfqFe3nuiYijYDD2P0uCS6E9qQ6vs86bin47wN00u5a0XEXG/ N9/+P1ShGkBju4WMFrbilnAnalGs9AcyshGH36V/Ooek3n956qim3CeTa5uHywT5 +KMkNuSOPVoV3Y7vfGqseQRCk2YLNdkuvdM52ISaf2dElZ+24rjF+7FN5DQQ4hrg r3pR3WWHo0qC9FeF9pXt6DwCypPdOShQGNRrtCacfLA2R9JrsbI= =EOjZ -----END PGP SIGNATURE----- --=-=-=--