mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
snap: Use build-snaps instead of building go from source
See https://forum.snapcraft.io/t/go-part-fails-with-go1-11-if-go-mod-exists-in-the-top-level-directory/7546/11
This commit is contained in:
parent
fb732d5322
commit
fa873a6cb3
1 changed files with 4 additions and 18 deletions
|
@ -24,32 +24,18 @@ parts:
|
||||||
prime:
|
prime:
|
||||||
- bin/git
|
- bin/git
|
||||||
|
|
||||||
go:
|
|
||||||
# Hugo's go.mod would interfere with the build of Go 1.11 in the
|
|
||||||
# parts/go/build/ subdirectory. Move go.mod out of the way
|
|
||||||
# as a workaround. (Note: 'override-build' does not work here,
|
|
||||||
# hence the use of the deprecated 'prepare' keyword.)
|
|
||||||
# See https://forum.snapcraft.io/t/go-plugin-go1-11-fails-if-go-mod-exists-in-the-top-level-directory/7546
|
|
||||||
prepare: |
|
|
||||||
set -x
|
|
||||||
( cd ../../.. && mv -v go.mod go.mod~ )
|
|
||||||
source-tag: go1.11
|
|
||||||
|
|
||||||
hugo:
|
hugo:
|
||||||
|
plugin: nil
|
||||||
|
build-snaps: [go/1.11/stable]
|
||||||
source: .
|
source: .
|
||||||
after: [go]
|
|
||||||
plugin: go
|
|
||||||
go-importpath: github.com/gohugoio/hugo
|
|
||||||
override-build: |
|
override-build: |
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
echo "\nStarting override-build:"
|
echo "\nStarting override-build:"
|
||||||
( cd ../../.. && mv -v go.mod~ go.mod || : )
|
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
export GOPATH=$(dirname $SNAPCRAFT_PART_INSTALL)/go
|
export GOPATH=$(realpath ../go)
|
||||||
export PATH=$GOPATH/bin:$PATH
|
export PATH=$GOPATH/bin:/snap/bin:$PATH
|
||||||
|
|
||||||
cd $GOPATH/src/github.com/gohugoio/hugo
|
|
||||||
echo ' * Running "go get -v github.com/magefile/mage"...'
|
echo ' * Running "go get -v github.com/magefile/mage"...'
|
||||||
go get -v github.com/magefile/mage
|
go get -v github.com/magefile/mage
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue