Refactoring part 1: Fix some annoying linter warnings in API code (#1064)

* names, constants of reusable strings, removed unneeded `if`, replaced deprecated imports

* more deprecated imports replaced

* What is this?))

* Fix a path and quote a var in Dockerfile

* Addressing review comments

---------

Co-authored-by: Konstantin Koval <kkb@ukr.net>
This commit is contained in:
Kostiantyn
2024-09-30 15:45:02 +03:00
committed by GitHub
parent 70a3944e21
commit d1193c5ca4
38 changed files with 334 additions and 309 deletions

View File

@@ -37,16 +37,16 @@ func CachePathForMedia(albumID int, mediaID int) (string, error) {
return photoCachePath, nil
}
var test_cache_path string = ""
var testCachePath string = ""
func ConfigureTestCache(tmp_dir string) {
test_cache_path = tmp_dir
func ConfigureTestCache(tmpDir string) {
testCachePath = tmpDir
}
// MediaCachePath returns the path for where the media cache is located on the file system
func MediaCachePath() string {
if test_cache_path != "" {
return test_cache_path
if testCachePath != "" {
return testCachePath
}
photoCache := EnvMediaCachePath.GetValue()

View File

@@ -1,7 +1,6 @@
package utils_test
import (
"io/ioutil"
"os"
"path"
"testing"
@@ -18,7 +17,7 @@ func TestIsDirSymlink(t *testing.T) {
test_utils.FilesystemTest(t)
// Prepare a temporary directory for testing purposes
dir, err := ioutil.TempDir("", "testing")
dir, err := os.MkdirTemp("", "testing")
if err != nil {
t.Fatalf("unable to create temp directory for testing")
}