Skip to content

Commit

Permalink
_js: add a nested Go module
Browse files Browse the repository at this point in the history
This is useful so we can pin exact GopherJS versions as requirements,
without adding them to the main module's graph. There are users of the
sh module out there who have no interest in the javascript library, so
they shouldn't be forced to ever see or download GopherJS's repository
or go.mod file.

Also replace the sh/v3 module with ../, so that the _js module is always
using the sh/v3 version from the very same git tree. This also means
there will be fewer network roundtrips, and the _js module will be up to
date by default.

We needed to call the nested module shjs instead of mvdan.cc/sh/v3/_js,
as that caused ambiguities for cmd/go. We actually don't care what the
module path of the JS module is, as it's never going to be importable
directly.
  • Loading branch information
mvdan committed Feb 25, 2019
1 parent 9fc0272 commit 53f2fd8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
2 changes: 0 additions & 2 deletions _js/build
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ export GO111MODULE=on # build in module-aware mode
go run github.com/gopherjs/gopherjs build -o index.js || exit 1

node testmain.js || exit 1

go mod tidy # to remove unnecessary gopherjs lines from go.mod
12 changes: 12 additions & 0 deletions _js/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module shjs

go 1.11

replace github.com/gopherjs/gopherjs => github.com/myitcv/gopherjs v0.0.0-20181206184521-f5b96be2a04c

replace mvdan.cc/sh/v3 => ../

require (
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e
mvdan.cc/sh/v3 v3.0.0-alpha0
)
35 changes: 35 additions & 0 deletions _js/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/myitcv/gopherjs v0.0.0-20181206184521-f5b96be2a04c h1:Anqc6H/ATT8okiZAOACY59ByomtxVvREjH3yx3xpAUU=
github.com/myitcv/gopherjs v0.0.0-20181206184521-f5b96be2a04c/go.mod h1:+hbiahOXtaQVul9rb+ZH7/WXxTkkLWf/LtHzbqjjfPo=
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86 h1:D6paGObi5Wud7xg83MaEFyjxQB1W5bz5d0IFppr+ymk=
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab h1:eFXv9Nu1lGbrNbj619aWwZfVF5HBrm9Plte8aNptuTI=
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
github.com/rogpeppe/go-internal v1.0.1-alpha.1 h1:NGPDe06RaK5iQFZkqFMNb986UARfoHc9FLyWI7b6+aQ=
github.com/rogpeppe/go-internal v1.0.1-alpha.1/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371 h1:SWV2fHctRpRrp49VXJ6UZja7gU9QLHwRpIPBN89SKEo=
github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/vfsgen v0.0.0-20180915214035-33ae1944be3f/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/pflag v1.0.1 h1:aCvUg6QPl3ibpQUxyLkrEkCHtPqYJL4x9AuhqVqFis4=
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
golang.org/x/crypto v0.0.0-20180807104621-f027049dab0a h1:PulT0Y50PcfTWomfsD39bSQyVrjjWdIuJKfyR4nOCJw=
golang.org/x/crypto v0.0.0-20180807104621-f027049dab0a/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd h1:VtIkGDhk0ph3t+THbvXHfMZ8QHgsBO39Nh52+74pq7w=
golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180807162357-acbc56fc7007 h1:UnHxDq9ldm4vol94wlSWDF3SU4IyC8IWVWtg266CzoY=
golang.org/x/sys v0.0.0-20180807162357-acbc56fc7007/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 h1:YoY1wS6JYVRpIfFngRf2HHo9R9dAne3xbkGOQ5rJXjU=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/tools v0.0.0-20180803180156-3c07937fe18c h1:Z6Xcg33osoOLCiz/EFPHedK6zJ9nl1KK4WH/LlykMxs=
golang.org/x/tools v0.0.0-20180803180156-3c07937fe18c/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ require (
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 // indirect
)

replace github.com/gopherjs/gopherjs => github.com/myitcv/gopherjs v0.0.0-20181206184521-f5b96be2a04c

0 comments on commit 53f2fd8

Please sign in to comment.