2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

Address issues reported by golint

This commit is contained in:
Alexander Neumann 2021-01-30 20:45:57 +01:00
parent f867e65bcd
commit 04ca69cc78
4 changed files with 9 additions and 17 deletions

View File

@ -489,7 +489,7 @@ func TestCheckerBlobTypeConfusion(t *testing.T) {
Nodes: []*restic.Node{malNode, dirNode},
}
rootId, err := repo.SaveTree(ctx, rootTree)
rootID, err := repo.SaveTree(ctx, rootTree)
test.OK(t, err)
test.OK(t, repo.Flush(ctx))
@ -498,12 +498,12 @@ func TestCheckerBlobTypeConfusion(t *testing.T) {
snapshot, err := restic.NewSnapshot([]string{"/damaged"}, []string{"test"}, "foo", time.Now())
test.OK(t, err)
snapshot.Tree = &rootId
snapshot.Tree = &rootID
snapId, err := repo.SaveJSONUnpacked(ctx, restic.SnapshotFile, snapshot)
snapID, err := repo.SaveJSONUnpacked(ctx, restic.SnapshotFile, snapshot)
test.OK(t, err)
t.Logf("saved snapshot %v", snapId.Str())
t.Logf("saved snapshot %v", snapID.Str())
delayRepo := &delayRepository{
Repository: repo,

View File

@ -219,17 +219,17 @@ func TestFuseDir(t *testing.T) {
}
// Test top-level directories for their UID and GID.
func TestTopUidGid(t *testing.T) {
func TestTopUIDGID(t *testing.T) {
repo, cleanup := repository.TestRepository(t)
defer cleanup()
restic.TestCreateSnapshot(t, repo, time.Unix(1460289341, 207401672), 0, 0)
testTopUidGid(t, Config{}, repo, uint32(os.Getuid()), uint32(os.Getgid()))
testTopUidGid(t, Config{OwnerIsRoot: true}, repo, 0, 0)
testTopUIDGID(t, Config{}, repo, uint32(os.Getuid()), uint32(os.Getgid()))
testTopUIDGID(t, Config{OwnerIsRoot: true}, repo, 0, 0)
}
func testTopUidGid(t *testing.T, cfg Config, repo restic.Repository, uid, gid uint32) {
func testTopUIDGID(t *testing.T, cfg Config, repo restic.Repository, uid, gid uint32) {
t.Helper()
ctx := context.Background()

View File

@ -157,7 +157,7 @@ var (
const (
// size of the header-length field at the end of the file; it is a uint32
headerLengthSize = 4
// constant overhead of the header independent of #entries
// HeaderSize is the header's constant overhead (independent of #entries)
HeaderSize = headerLengthSize + crypto.Extension
maxHeaderSize = 16 * 1024 * 1024

View File

@ -44,14 +44,6 @@ func (i *TestRepo) Lookup(bh restic.BlobHandle) []restic.PackedBlob {
return packs
}
func (i *TestRepo) packName(pack *packInfo) string {
return i.packsIDToName[pack.id]
}
func (i *TestRepo) packID(name string) restic.ID {
return i.packsNameToID[name]
}
func (i *TestRepo) fileContent(file *fileInfo) string {
return i.filesPathToContent[file.location]
}