Browse Source

chore: Small changes for Go 1.16.3

Matthias Ladkau 3 years ago
parent
commit
627ad282e8

+ 7 - 0
Makefile

@@ -10,12 +10,18 @@ clean:
 mod:
 	go mod init || true
 	go mod tidy
+
 test:
 	go test -p 1 ./...
+
+test-mac:
+	GOOS=darwin GOARCH=amd64 go test -p 1 ./...
+
 cover:
 	go test -p 1 --coverprofile=coverage.out ./...
 	go tool cover --html=coverage.out -o coverage.html
 	sh -c "open coverage.html || xdg-open coverage.html" 2>/dev/null
+
 fmt:
 	gofmt -l -w -s .
 
@@ -73,6 +79,7 @@ dist: build build-win build-mac build-arm7 build-arm8
 	cp -fR examples dist/$(NAME)_arm8
 	cp LICENSE dist/$(NAME)_arm8
 	cp NOTICE dist/$(NAME)_arm8
+
 	tar --directory=dist -cz $(NAME)_arm8 > dist/$(NAME)_$(TAG)_arm8.tar.gz
 
 	sh -c 'cd dist; sha256sum *.tar.gz' > dist/checksums.txt

+ 1 - 1
cluster/manager/config_test.go

@@ -21,7 +21,7 @@ import (
 	"devt.de/krotik/common/datautil"
 )
 
-const invalidFileName = "**" + string(0x0)
+const invalidFileName = "**" + "\x00"
 
 func TestDefaultStateInfo(t *testing.T) {
 

+ 1 - 1
config/config_test.go

@@ -9,7 +9,7 @@ import (
 
 const testconf = "testconfig"
 
-const invalidFileName = "**" + string(0x0)
+const invalidFileName = "**" + "\x00"
 
 func TestConfig(t *testing.T) {
 

+ 5 - 5
graph/globals.go

@@ -108,7 +108,7 @@ const VERSION = 1
 /*
 MainDBEntryPrefix is the prefix for entries stored in the main database
 */
-const MainDBEntryPrefix = string(0x2)
+const MainDBEntryPrefix = "\x02"
 
 // MainDB entries
 // ==============
@@ -204,22 +204,22 @@ const StorageSuffixEdgesIndex = ".edgeidx"
 /*
 PrefixNSAttrs is the prefix for storing attributes of a node
 */
-const PrefixNSAttrs = string(0x01)
+const PrefixNSAttrs = "\x01"
 
 /*
 PrefixNSAttr is the prefix for storing the value of a node attribute
 */
-const PrefixNSAttr = string(0x02)
+const PrefixNSAttr = "\x02"
 
 /*
 PrefixNSSpecs is the prefix for storing specs of edges related to a node
 */
-const PrefixNSSpecs = string(0x03)
+const PrefixNSSpecs = "\x03"
 
 /*
 PrefixNSEdge is the prefix for storing a link from a node (and a spec) to an edge
 */
-const PrefixNSEdge = string(0x04)
+const PrefixNSEdge = "\x04"
 
 // Graph events
 //=============

+ 1 - 1
graph/graphmanager_test.go

@@ -37,7 +37,7 @@ var DBDIRS = []string{GraphManagerTestDBDir1, GraphManagerTestDBDir2,
 	GraphManagerTestDBDir3, GraphManagerTestDBDir4, GraphManagerTestDBDir5,
 	GraphManagerTestDBDir6}
 
-const InvlaidFileName = "**" + string(0x0)
+const InvlaidFileName = "**" + "\x00"
 
 // Main function for all tests in this package
 

+ 1 - 1
graph/graphstorage/diskgraphstorage_test.go

@@ -27,7 +27,7 @@ const diskGraphStorageTestDBDir2 = "diskgraphstoragetest2"
 
 var dbdirs = []string{diskGraphStorageTestDBDir, diskGraphStorageTestDBDir2}
 
-const invalidFileName = "**" + string(0x0)
+const invalidFileName = "**" + "\x00"
 
 // Main function for all tests in this package
 

+ 2 - 2
graph/util/indexmanager.go

@@ -39,12 +39,12 @@ var CaseSensitiveWordIndex = false
 /*
 PrefixAttrWord is the prefix used for word index entries
 */
-const PrefixAttrWord = string(0x01)
+const PrefixAttrWord = "\x01"
 
 /*
 PrefixAttrHash is the prefix used for hashes of attribute values
 */
-const PrefixAttrHash = string(0x02)
+const PrefixAttrHash = "\x01"
 
 /*
 IndexManager data structure

+ 2 - 0
graph/util/indexmanager_test.go

@@ -761,6 +761,8 @@ func TestIndexManagerString(t *testing.T) {
 	im.Index("testkey", obj1)
 
 	if res := im.String(); res != "IndexManager: 1\n"+
+		"    1\"aaa\\b\\xf8\\xe0&\\fdA\\x85\\x10\\xce\\xfb+\\x06\\xee\\xe5\\xcd\" map[testkey:[]]\n"+
+		"    1\"aaabbb\" map[testkey:[1]]\n" && res != "IndexManager: 1\n"+
 		"    1\"aaabbb\" map[testkey:[1]]\n"+
 		"    2\"aaa\\b\\xf8\\xe0&\\fdA\\x85\\x10\\xce\\xfb+\\x06\\xee\\xe5\\xcd\" map[testkey:[]]\n" {
 		t.Error("Unexpected string output:", res)

+ 5 - 5
graph/util/namesmanager.go

@@ -15,27 +15,27 @@ import "encoding/binary"
 /*
 PrefixCode is the prefix for entries storing codes
 */
-const PrefixCode = string(0x0)
+const PrefixCode = "\x00"
 
 /*
 PrefixName is the prefix for entries storing names
 */
-const PrefixName = string(0x1)
+const PrefixName = "\x01"
 
 /*
 PrefixCounter is the prefix for counter entries
 */
-const PrefixCounter = string(0x0)
+const PrefixCounter = "\x00"
 
 /*
 Prefix16Bit is the prefix for 16 bit kind related entries
 */
-const Prefix16Bit = string(0x1)
+const Prefix16Bit = "\x01"
 
 /*
 Prefix32Bit is the prefix for attribute related entries
 */
-const Prefix32Bit = string(0x2)
+const Prefix32Bit = "\x02"
 
 /*
 NamesManager data structure

+ 1 - 1
server/server_test.go

@@ -42,7 +42,7 @@ const RunLongRunningTests = true
 
 const testdb = "testdb"
 
-const invalidFileName = "**" + string(0x0)
+const invalidFileName = "**" + "\x00"
 
 var printLog = []string{}
 var errorLog = []string{}

+ 1 - 1
storage/diskstoragemanager_test.go

@@ -589,7 +589,7 @@ func TestDiskStorageManagerRollback(t *testing.T) {
 	}
 }
 
-const InvalidFileName = "**" + string(0x0)
+const InvalidFileName = "**" + "\x00"
 
 func TestDiskStorageManagerInit(t *testing.T) {
 	lockfile := lockutil.NewLockFile(DBDIR+"/"+"lock0.lck", time.Duration(50)*time.Millisecond)

+ 1 - 1
storage/file/storagefile_test.go

@@ -21,7 +21,7 @@ import (
 
 const DBDir = "storagefiletest"
 
-const InvalidFileName = "**" + string(0x0)
+const InvalidFileName = "**" + "\x00"
 
 func TestMain(m *testing.M) {
 	flag.Parse()

+ 1 - 1
storage/paging/pagedstoragefile_test.go

@@ -23,7 +23,7 @@ import (
 
 const DBDIR = "pagingtest"
 
-const InvalidFileName = "**" + string(0x0)
+const InvalidFileName = "**" + "\x00"
 
 // Main function for all tests in this package