From 9f1fe62e05115bd355799be7a633231686363c48 Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Wed, 1 Mar 2023 21:51:24 +0900 Subject: [PATCH] min go version 1.18, include tip for test (#532) * min go version 1.18, include tip for test * lint * lint * lint * lint * lint * lint * lint * lint * lint * lint * lint * lint * lint --- .github/workflows/test.yml | 26 +++++++++++++++++++------- server/server.go | 2 -- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 123b8d0..242bb8d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,16 +13,27 @@ jobs: fail-fast: false matrix: go_version: - - 1.15.x - - 1.16.x - - 1.17.x - - 1.18.X + - '1.18' + - '1.19' + - '1.20' + - tip name: Test with ${{ matrix.go_version }} steps: - uses: actions/checkout@v2 - - uses: actions/setup-go@v1 + - name: Install Go ${{ matrix.go_version }} + if: ${{ matrix.go_version != 'tip' }} + uses: actions/setup-go@master with: go-version: ${{ matrix.go_version }} + check-latest: true + - name: Install Go ${{ matrix.go_version }} + if: ${{ matrix.go_version == 'tip' }} + run: | + curl -sL https://storage.googleapis.com/go-build-snap/go/linux-amd64/$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1;}').tar.gz -o gotip.tar.gz + ls -lah gotip.tar.gz + mkdir -p ~/sdk/gotip + tar -C ~/sdk/gotip -xzf gotip.tar.gz + echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV - name: Vet and test run: | go version @@ -33,9 +44,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-go@v1 + - uses: actions/setup-go@master with: - go-version: 1.18 + go-version: '1.20' + check-latest: true - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: diff --git a/server/server.go b/server/server.go index ca42273..fb0c9d0 100644 --- a/server/server.go +++ b/server/server.go @@ -466,8 +466,6 @@ func (s *Server) Run() { r.HandleFunc("/{action:(?:download|get|inline)}/{token}/{filename}", s.headHandler).Methods("HEAD") r.HandleFunc("/{token}/{filename}", s.previewHandler).MatcherFunc(func(r *http.Request, rm *mux.RouteMatch) (match bool) { - match = false - // The file will show a preview page when opening the link in browser directly or // from external link. If the referer url path and current path are the same it will be // downloaded.