snapcraft: Set GO111MODULE=on in override-build script
authorAnthony Fok <foka@debian.org>
Tue, 25 Sep 2018 04:15:42 +0000 (22:15 -0600)
committerAnthony Fok <foka@debian.org>
Tue, 25 Sep 2018 04:15:42 +0000 (22:15 -0600)
Apparently, snapcraft's yet-to-be-documented environment declaration
feature is for run-time only.

See https://discourse.gohugo.io/t/hugo-0-48-released/13908/9
and https://forum.snapcraft.io/t/declaratively-defining-environment-variables/175/29

snapcraft.yaml

index 64493c5cd94b01f87288a90506bd7fa974beee7c..6b2cc6bfea9c1e021cc74918eea8885fec921d89 100644 (file)
@@ -7,8 +7,6 @@ description: |
   with content and templates and renders them into a full HTML website.
 confinement: strict
 grade: devel # "devel" or "stable"
-environment:
-    GO111MODULE: on
 
 apps:
   hugo:
@@ -25,6 +23,7 @@ parts:
       - git
     override-build: |
       echo "\nStarting override-build:"
+      export GO111MODULE=on
       export GOPATH=$(dirname $SNAPCRAFT_PART_INSTALL)/go
       export PATH=$GOPATH/bin:$PATH
       cd $GOPATH/src/github.com/gohugoio/hugo