From 3e326d3407b16df28f3f82b9da94a2a686a775bd Mon Sep 17 00:00:00 2001 From: Guillermo Prandi Date: Sat, 4 Apr 2020 18:56:05 -0300 Subject: [PATCH 1/4] Prevent support libraries from compiling into Gitea --- Makefile | 2 +- build/vendor.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9663e8b6dd49e..7af41ab74b907 100644 --- a/Makefile +++ b/Makefile @@ -301,7 +301,7 @@ unit-test-coverage: .PHONY: vendor vendor: - $(GO) mod tidy && $(GO) mod vendor + $(GO) mod tidy && TAGS="$(TAGS) vendor" $(GO) mod vendor .PHONY: test-vendor test-vendor: vendor diff --git a/build/vendor.go b/build/vendor.go index d51fbf21fb612..2dcd252cb25b4 100644 --- a/build/vendor.go +++ b/build/vendor.go @@ -4,6 +4,8 @@ package build +//+build vendor + import ( // for lint _ "github.com/BurntSushi/toml" From f3195c4386bd75387cc44caa51b5ac3df0640f6a Mon Sep 17 00:00:00 2001 From: Guillermo Prandi Date: Sat, 4 Apr 2020 19:09:32 -0300 Subject: [PATCH 2/4] Fix tag position --- build/vendor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/vendor.go b/build/vendor.go index 2dcd252cb25b4..939706ea1f3a6 100644 --- a/build/vendor.go +++ b/build/vendor.go @@ -2,10 +2,10 @@ // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package build - //+build vendor +package build + import ( // for lint _ "github.com/BurntSushi/toml" From 94f74f8dce3b8d0bf3519dc42b0727e4e2749b35 Mon Sep 17 00:00:00 2001 From: Guillermo Prandi Date: Sat, 4 Apr 2020 19:22:03 -0300 Subject: [PATCH 3/4] Fix golangci-lint errors --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7af41ab74b907..98dea9d42bbf9 100644 --- a/Makefile +++ b/Makefile @@ -617,4 +617,4 @@ golangci-lint: export BINARY="golangci-lint"; \ curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.24.0; \ fi - golangci-lint run --timeout 5m + TAGS="$(TAGS) vendor" golangci-lint run --timeout 5m From 8425556ace2eae231087abe55ada5691be15b360 Mon Sep 17 00:00:00 2001 From: Guillermo Prandi Date: Sat, 4 Apr 2020 19:40:36 -0300 Subject: [PATCH 4/4] Refactor to make it work --- Makefile | 2 +- build/vendor.go => build.go | 5 ++++- main.go | 3 --- 3 files changed, 5 insertions(+), 5 deletions(-) rename build/vendor.go => build.go (77%) diff --git a/Makefile b/Makefile index 98dea9d42bbf9..7af41ab74b907 100644 --- a/Makefile +++ b/Makefile @@ -617,4 +617,4 @@ golangci-lint: export BINARY="golangci-lint"; \ curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.24.0; \ fi - TAGS="$(TAGS) vendor" golangci-lint run --timeout 5m + golangci-lint run --timeout 5m diff --git a/build/vendor.go b/build.go similarity index 77% rename from build/vendor.go rename to build.go index 939706ea1f3a6..22c6ded99c1c5 100644 --- a/build/vendor.go +++ b/build.go @@ -4,7 +4,10 @@ //+build vendor -package build +package main + +// Libraries that are included to vendor utilities used during build. +// These libraries will not be included in a normal compilation. import ( // for lint diff --git a/main.go b/main.go index ecf161bf100b6..90feaa9bb0e3b 100644 --- a/main.go +++ b/main.go @@ -21,9 +21,6 @@ import ( _ "code.gitea.io/gitea/modules/markup/markdown" _ "code.gitea.io/gitea/modules/markup/orgmode" - // for build - _ "code.gitea.io/gitea/build" - "github.com/urfave/cli" )