diff --git a/.github/workflows/test-code.yml b/.github/workflows/test-code.yml index 47358ea..857eb6d 100644 --- a/.github/workflows/test-code.yml +++ b/.github/workflows/test-code.yml @@ -11,7 +11,7 @@ jobs: uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '^1.17' + go-version: '^1.18' - run: go generate ./... - run: go test ./... -parallel 8 --tags=test,awsmock - run: go clean -testcache diff --git a/Dockerfile b/Dockerfile index 157cd5b..dabe683 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17 AS build_base +FROM golang:1.18 AS build_base ## Usage: ## docker build . -t gokapi diff --git a/build/Dockerfile b/build/Dockerfile index 251f185..cd10fd7 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17 +FROM golang:1.18 ## To compile: ## cd Gokapi/build/ diff --git a/build/go.mod b/build/go.mod index 034d0d8..c255cb0 100644 --- a/build/go.mod +++ b/build/go.mod @@ -1,6 +1,6 @@ module github.com/forceu/gokapi -go 1.17 +go 1.18 require ( git.mills.io/prologic/bitcask v1.0.2 diff --git a/cmd/gokapi/Main.go b/cmd/gokapi/Main.go index d3d92ee..dc17824 100644 --- a/cmd/gokapi/Main.go +++ b/cmd/gokapi/Main.go @@ -23,15 +23,16 @@ import ( "math/rand" "os" "os/signal" + "runtime/debug" "syscall" "time" ) // Version is the current version in readable form. // The go generate call below needs to be modified as well -const Version = "1.5.1" +const Version = "1.5.2" -//go:generate sh "../../build/setVersionTemplate.sh" "1.5.1" +//go:generate sh "../../build/setVersionTemplate.sh" "1.5.2" //go:generate sh -c "cp \"$(go env GOROOT)/misc/wasm/wasm_exec.js\" ../../internal/webserver/web/static/js/ && echo Copied wasm_exec.js" //go:generate sh -c "GOOS=js GOARCH=wasm go build -o ../../internal/webserver/web/main.wasm github.com/forceu/gokapi/cmd/wasmdownloader && echo Compiled WASM module" @@ -74,6 +75,12 @@ func showVersion(passedFlags flags) { fmt.Println("Builder: " + environment.Builder) fmt.Println("Build Date: " + environment.BuildTime) fmt.Println("Docker Version: " + environment.IsDocker) + info, ok := debug.ReadBuildInfo() + if ok { + fmt.Println("Go Version: " + info.GoVersion) + } else { + fmt.Println("Go Version: unknown") + } osExit(0) } } diff --git a/cmd/gokapi/Main_test.go b/cmd/gokapi/Main_test.go index 558195b..f63181d 100644 --- a/cmd/gokapi/Main_test.go +++ b/cmd/gokapi/Main_test.go @@ -1,5 +1,4 @@ //go:build !integration && test -// +build !integration,test package main diff --git a/cmd/wasmdownloader/Main.go b/cmd/wasmdownloader/Main.go index c7ab9c3..8385238 100644 --- a/cmd/wasmdownloader/Main.go +++ b/cmd/wasmdownloader/Main.go @@ -1,5 +1,4 @@ //go:build js && wasm -// +build js,wasm package main diff --git a/go.mod b/go.mod index 034d0d8..c255cb0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/forceu/gokapi -go 1.17 +go 1.18 require ( git.mills.io/prologic/bitcask v1.0.2 diff --git a/go.sum b/go.sum index 286959c..b8da99e 100644 --- a/go.sum +++ b/go.sum @@ -516,7 +516,6 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486 h1:5hpz5aRr+W1erYCL5JRhSUBJRph7l9XkNveoExlrKYk= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= diff --git a/internal/configuration/Configuration_test.go b/internal/configuration/Configuration_test.go index d842e8e..9f1de3e 100644 --- a/internal/configuration/Configuration_test.go +++ b/internal/configuration/Configuration_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package configuration import ( diff --git a/internal/configuration/cloudconfig/CloudConfig_test.go b/internal/configuration/cloudconfig/CloudConfig_test.go index 719b15a..3751776 100644 --- a/internal/configuration/cloudconfig/CloudConfig_test.go +++ b/internal/configuration/cloudconfig/CloudConfig_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package cloudconfig import ( diff --git a/internal/configuration/setup/Setup.go b/internal/configuration/setup/Setup.go index 183b084..1e2741c 100644 --- a/internal/configuration/setup/Setup.go +++ b/internal/configuration/setup/Setup.go @@ -341,9 +341,6 @@ func parseServerSettings(result *models.Configuration, formObjects *[]jsonFormOb return err } result.PicturesAlwaysLocal = picturesAlwaysLocal == "local" - fmt.Println(picturesAlwaysLocal) - fmt.Println(result.PicturesAlwaysLocal) - return nil } diff --git a/internal/environment/Environment_test.go b/internal/environment/Environment_test.go index 08776da..6f52f7f 100644 --- a/internal/environment/Environment_test.go +++ b/internal/environment/Environment_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package environment import ( diff --git a/internal/helper/OS_test.go b/internal/helper/OS_test.go index cafa346..a9bfad7 100644 --- a/internal/helper/OS_test.go +++ b/internal/helper/OS_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package helper import ( diff --git a/internal/helper/StringGeneration_test.go b/internal/helper/StringGeneration_test.go index a301127..b7d561b 100644 --- a/internal/helper/StringGeneration_test.go +++ b/internal/helper/StringGeneration_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package helper import ( diff --git a/internal/logging/Logging_test.go b/internal/logging/Logging_test.go index 095e38c..47ff880 100644 --- a/internal/logging/Logging_test.go +++ b/internal/logging/Logging_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package logging import ( diff --git a/internal/models/AwsConfig_test.go b/internal/models/AwsConfig_test.go index d2ff1d6..e5076a1 100644 --- a/internal/models/AwsConfig_test.go +++ b/internal/models/AwsConfig_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package models import ( diff --git a/internal/models/FileList_test.go b/internal/models/FileList_test.go index b9d9cd0..fffe4d0 100644 --- a/internal/models/FileList_test.go +++ b/internal/models/FileList_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package models import ( diff --git a/internal/storage/FileServing_test.go b/internal/storage/FileServing_test.go index 8648564..00982ff 100644 --- a/internal/storage/FileServing_test.go +++ b/internal/storage/FileServing_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package storage import ( diff --git a/internal/storage/cloudstorage/aws/AwsS3.go b/internal/storage/cloudstorage/aws/AwsS3.go index 75316b3..a070a3e 100644 --- a/internal/storage/cloudstorage/aws/AwsS3.go +++ b/internal/storage/cloudstorage/aws/AwsS3.go @@ -1,5 +1,4 @@ //go:build !noaws && !awsmock -// +build !noaws,!awsmock package aws diff --git a/internal/storage/cloudstorage/aws/AwsS3_mock.go b/internal/storage/cloudstorage/aws/AwsS3_mock.go index a7e7150..671dfc7 100644 --- a/internal/storage/cloudstorage/aws/AwsS3_mock.go +++ b/internal/storage/cloudstorage/aws/AwsS3_mock.go @@ -1,5 +1,4 @@ //go:build !noaws && awsmock -// +build !noaws,awsmock package aws diff --git a/internal/storage/cloudstorage/aws/AwsS3_slim.go b/internal/storage/cloudstorage/aws/AwsS3_slim.go index 3bacfc5..226c12b 100644 --- a/internal/storage/cloudstorage/aws/AwsS3_slim.go +++ b/internal/storage/cloudstorage/aws/AwsS3_slim.go @@ -1,5 +1,4 @@ //go:build noaws -// +build noaws package aws diff --git a/internal/storage/cloudstorage/aws/AwsS3_test.go b/internal/storage/cloudstorage/aws/AwsS3_test.go index be3284d..c84c8f2 100644 --- a/internal/storage/cloudstorage/aws/AwsS3_test.go +++ b/internal/storage/cloudstorage/aws/AwsS3_test.go @@ -1,5 +1,4 @@ //go:build awstest && !awsmock && test -// +build awstest,!awsmock,test package aws diff --git a/internal/test/TestHelper.go b/internal/test/TestHelper.go index e7a7904..4ca8a04 100644 --- a/internal/test/TestHelper.go +++ b/internal/test/TestHelper.go @@ -1,5 +1,4 @@ //go:build test -// +build test package test diff --git a/internal/test/TestHelper_test.go b/internal/test/TestHelper_test.go index f823f3a..0a9477c 100644 --- a/internal/test/TestHelper_test.go +++ b/internal/test/TestHelper_test.go @@ -1,5 +1,4 @@ //go:build test -// +build test package test diff --git a/internal/test/testconfiguration/TestConfiguration.go b/internal/test/testconfiguration/TestConfiguration.go index 0ab64e6..9d3d870 100644 --- a/internal/test/testconfiguration/TestConfiguration.go +++ b/internal/test/testconfiguration/TestConfiguration.go @@ -1,5 +1,4 @@ //go:build test -// +build test package testconfiguration diff --git a/internal/test/testconfiguration/TestConfiguration_test.go b/internal/test/testconfiguration/TestConfiguration_test.go index 4161bc3..acb44fe 100644 --- a/internal/test/testconfiguration/TestConfiguration_test.go +++ b/internal/test/testconfiguration/TestConfiguration_test.go @@ -1,5 +1,4 @@ //go:build test -// +build test package testconfiguration diff --git a/internal/webserver/Webserver_test.go b/internal/webserver/Webserver_test.go index 5fe53a5..dffab57 100644 --- a/internal/webserver/Webserver_test.go +++ b/internal/webserver/Webserver_test.go @@ -1,5 +1,4 @@ //go:build !integration && test -// +build !integration,test package webserver @@ -18,9 +17,6 @@ import ( "time" ) -// Please note that if this test is run with go test -race, it will fail as there is a bug in html/template that -// causes data race. It will be fixed in Go 1.17, see https://github.com/golang/go/issues/39807 - func TestMain(m *testing.M) { testconfiguration.Create(true) configuration.Load() diff --git a/internal/webserver/api/Api_test.go b/internal/webserver/api/Api_test.go index 675e493..3818133 100644 --- a/internal/webserver/api/Api_test.go +++ b/internal/webserver/api/Api_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package api import ( diff --git a/internal/webserver/authentication/sessionmanager/SessionManager_test.go b/internal/webserver/authentication/sessionmanager/SessionManager_test.go index 4507fdc..77a1bf6 100644 --- a/internal/webserver/authentication/sessionmanager/SessionManager_test.go +++ b/internal/webserver/authentication/sessionmanager/SessionManager_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package sessionmanager import ( diff --git a/internal/webserver/downloadstatus/DownloadStatus_test.go b/internal/webserver/downloadstatus/DownloadStatus_test.go index 71e4db9..051a530 100644 --- a/internal/webserver/downloadstatus/DownloadStatus_test.go +++ b/internal/webserver/downloadstatus/DownloadStatus_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package downloadstatus import ( diff --git a/internal/webserver/fileupload/FileUpload_test.go b/internal/webserver/fileupload/FileUpload_test.go index abcc87e..f1426dd 100644 --- a/internal/webserver/fileupload/FileUpload_test.go +++ b/internal/webserver/fileupload/FileUpload_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package fileupload import ( diff --git a/internal/webserver/ssl/Ssl_test.go b/internal/webserver/ssl/Ssl_test.go index 9709b7c..50f4227 100644 --- a/internal/webserver/ssl/Ssl_test.go +++ b/internal/webserver/ssl/Ssl_test.go @@ -1,6 +1,3 @@ -//go:build test -// +build test - package ssl import ( diff --git a/internal/webserver/web/templates/string_constants.tmpl b/internal/webserver/web/templates/string_constants.tmpl index 17b6d6f..7b1406a 100644 --- a/internal/webserver/web/templates/string_constants.tmpl +++ b/internal/webserver/web/templates/string_constants.tmpl @@ -1,2 +1,2 @@ {{define "app_name"}}Gokapi{{end}} -{{define "version"}}1.5.1{{end}} +{{define "version"}}1.5.2{{end}}