From c8a019e22a550efd769c11581ac7455a756766ed Mon Sep 17 00:00:00 2001 From: Marc Ole Bulling Date: Fri, 7 May 2021 17:15:12 +0200 Subject: [PATCH] Fixed lint issues, set Go version to 1.16.4 --- Dockerfile | 2 +- build/Dockerfile | 2 +- internal/models/Api.go | 2 +- internal/models/FileUpload.go | 3 ++- internal/test/testconfiguration/TestConfiguration_test.go | 2 +- internal/webserver/api/Api.go | 2 ++ internal/webserver/fileupload/FileUpload.go | 1 + 7 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0d198bf..d582522 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.16 AS build_base +FROM golang:1.16.4 AS build_base ## Usage: ## docker build . -t gokapi diff --git a/build/Dockerfile b/build/Dockerfile index cd5620a..f021ccf 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.16 +FROM golang:1.16.4 ## To compile: ## cd Gokapi/build/ diff --git a/internal/models/Api.go b/internal/models/Api.go index b5069d4..067a7ea 100644 --- a/internal/models/Api.go +++ b/internal/models/Api.go @@ -6,4 +6,4 @@ type ApiKey struct { FriendlyName string `json:"FriendlyName"` LastUsed int64 `json:"LastUsed"` LastUsedString string `json:"LastUsedString"` -} \ No newline at end of file +} diff --git a/internal/models/FileUpload.go b/internal/models/FileUpload.go index eac5f1e..2852e5c 100644 --- a/internal/models/FileUpload.go +++ b/internal/models/FileUpload.go @@ -1,9 +1,10 @@ package models +// UploadRequest is used to set an upload request type UploadRequest struct { AllowedDownloads int Expiry int - ExpiryTimestamp int64 + ExpiryTimestamp int64 Password string ExternalUrl string } diff --git a/internal/test/testconfiguration/TestConfiguration_test.go b/internal/test/testconfiguration/TestConfiguration_test.go index 9bfbc05..30c6cb4 100644 --- a/internal/test/testconfiguration/TestConfiguration_test.go +++ b/internal/test/testconfiguration/TestConfiguration_test.go @@ -31,4 +31,4 @@ func TestSetUpgradeConfigFile(t *testing.T) { WriteUpgradeConfigFile() test.IsEqualBool(t, helper.FileExists(configFile), true) TestDelete(t) -} \ No newline at end of file +} diff --git a/internal/webserver/api/Api.go b/internal/webserver/api/Api.go index 068d049..694a1a6 100644 --- a/internal/webserver/api/Api.go +++ b/internal/webserver/api/Api.go @@ -38,6 +38,7 @@ func Process(w http.ResponseWriter, r *http.Request) { } } +// DeleteKey deletes the selected API key func DeleteKey(id string) bool { if !isValidKey(id, false) { return false @@ -48,6 +49,7 @@ func DeleteKey(id string) bool { return true } +// NewKey generates a new API key func NewKey() string { settings := configuration.GetServerSettings() newKey := models.ApiKey{ diff --git a/internal/webserver/fileupload/FileUpload.go b/internal/webserver/fileupload/FileUpload.go index 76764cf..0fa9220 100644 --- a/internal/webserver/fileupload/FileUpload.go +++ b/internal/webserver/fileupload/FileUpload.go @@ -11,6 +11,7 @@ import ( "time" ) +// Process processes a file upload request func Process(w http.ResponseWriter, r *http.Request, isWeb bool) error { err := r.ParseMultipartForm(20 * 1024 * 1024) if err != nil {