From d9feddb6cd5898d95dc1b92e3167aea535b3aa9e Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 3 Dec 2020 13:26:59 +0300 Subject: [PATCH 1/1] Update dependency, move to redo --- .gitignore | 1 + Makefile | 13 ------------- all.do | 1 + go.mod | 4 ++-- main.go | 4 ++-- mmfileget.do | 2 ++ vendor-done.do | 6 ++++++ 7 files changed, 14 insertions(+), 17 deletions(-) delete mode 100644 Makefile create mode 100644 all.do create mode 100644 mmfileget.do create mode 100644 vendor-done.do diff --git a/.gitignore b/.gitignore index 19b737d..3f1a70c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ mattermost-server mmfileget vendor +vendor-done diff --git a/Makefile b/Makefile deleted file mode 100644 index 56163a4..0000000 --- a/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -GO ?= go - -all: mmfileget - -mmfileget: main.go mattermost-server vendor - $(GO) build -mod=vendor - -mattermost-server: - git clone --depth 1 --branch v5.11.1 https://github.com/mattermost/mattermost-server.git - -vendor: mattermost-server - ln -s mattermost-server/vendor - ln -s $(PWD)/mattermost-server vendor/github.com/mattermost/mattermost-server diff --git a/all.do b/all.do new file mode 100644 index 0000000..c4da23a --- /dev/null +++ b/all.do @@ -0,0 +1 @@ +redo-ifchange mmfileget diff --git a/go.mod b/go.mod index 37e097c..74b652c 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module go.stargrave.org/mmfileget go 1.13 -require github.com/mattermost/mattermost-server v5.11.1+incompatible +require github.com/mattermost/mattermost-server v5.29.0+incompatible -replace github.com/mattermost/mattermost-server v5.11.1+incompatible => ./mattermost-server +replace github.com/mattermost/mattermost-server v5.29.0+incompatible => ./mattermost-server diff --git a/main.go b/main.go index 1e717ec..d878296 100644 --- a/main.go +++ b/main.go @@ -7,11 +7,11 @@ import ( "path/filepath" "strings" - "github.com/mattermost/mattermost-server/model" + "github.com/mattermost/mattermost-server/v5/model" ) func main() { - url := os.Args[1] // https://MACHINE/api/v4/files/FILE + url := strings.TrimPrefix(os.Args[1], "-") // -?https://MACHINE/api/v4/files/FILE s := strings.Split(url, "/") machine, fileId := s[2], s[6] diff --git a/mmfileget.do b/mmfileget.do new file mode 100644 index 0000000..fb22a9e --- /dev/null +++ b/mmfileget.do @@ -0,0 +1,2 @@ +redo-ifchange main.go vendor-done +${GO:-go} build -o $3 -mod=vendor diff --git a/vendor-done.do b/vendor-done.do new file mode 100644 index 0000000..0e0c937 --- /dev/null +++ b/vendor-done.do @@ -0,0 +1,6 @@ +git clone --depth 1 --branch v5.29.0 https://github.com/mattermost/mattermost-server.git +ln -fs mattermost-server/vendor . +rm vendor/modules.txt +mkdir -p vendor/github.com/mattermost/mattermost-server +ln -fs `pwd`/mattermost-server vendor/github.com/mattermost/mattermost-server/v5 +touch $3 -- 2.44.0