From ec34eb4919f01879b180418df5b0364bf47456b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 5 May 2020 23:28:28 +0100 Subject: [PATCH] cmd: add a go.local.mod for development MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's essentially a copy of go.mod, but with the gioui.org module replaed with the parent directory. Useful when wanting to try a change in the root module as part of a gogio invocation or end-to-end test, such as either of the following: $ cd cmd; go test -modfile=go.local.mod ./... $ cd cmd/gogio; go build -modfile=../go.local.mod Since go.sum can essentially be shared, and since it seems to work with the go tool, use a symlink. The way the -modfile flag works, if given foo.mod, it will use the sum file at foo.sum. The only caveat is that 'go mod tidy -modfile=go.mod.local' will try to remove gioui.org lines, since that module is replaced. So tidy shouldn't be used with -modfile. In the future, the only upkeep needed for go.local.mod is to update the external dependencies to mirror changes in go.mod. This is not automated nor checked by CI, but it could be in the future if it becomes repetitive or error-prone. Signed-off-by: Daniel Martí --- .builds/linux.yml | 1 + cmd/go.local.mod | 14 ++++++++++++++ cmd/go.local.sum | 1 + 3 files changed, 16 insertions(+) create mode 100644 cmd/go.local.mod create mode 120000 cmd/go.local.sum diff --git a/.builds/linux.yml b/.builds/linux.yml index d2257e90..6161bb71 100644 --- a/.builds/linux.yml +++ b/.builds/linux.yml @@ -46,6 +46,7 @@ tasks: cd gio/cmd go test ./... go test -race ./... + go test -modfile=go.local.mod ./... - test_example: | cd gio/example go test -race ./... diff --git a/cmd/go.local.mod b/cmd/go.local.mod new file mode 100644 index 00000000..774b55b4 --- /dev/null +++ b/cmd/go.local.mod @@ -0,0 +1,14 @@ +module gioui.org/cmd + +go 1.13 + +require ( + gioui.org v0.0.0-00010101000000-000000000000 + github.com/chromedp/cdproto v0.0.0-20191114225735-6626966fbae4 + github.com/chromedp/chromedp v0.5.2 + golang.org/x/image v0.0.0-20190802002840-cff245a6509b + golang.org/x/sync v0.0.0-20190423024810-112230192c58 + golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e +) + +replace gioui.org => ../ diff --git a/cmd/go.local.sum b/cmd/go.local.sum new file mode 120000 index 00000000..c14a2974 --- /dev/null +++ b/cmd/go.local.sum @@ -0,0 +1 @@ +go.sum \ No newline at end of file