aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.golangci.yaml1
-rw-r--r--internal/cpu/cpu.go2
-rw-r--r--internal/cpu/cpu_amd64.go3
-rw-r--r--receivepack/service/run_hook.go1
-rw-r--r--refstore/files/batch_apply.go3
-rw-r--r--refstore/files/transaction_commit.go1
-rw-r--r--refstore/files/update_prepare_lock.go1
-rw-r--r--refstore/files/update_prepare_resolve.go1
8 files changed, 12 insertions, 1 deletions
diff --git a/.golangci.yaml b/.golangci.yaml
index c02cb461..74c974a2 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -21,6 +21,7 @@ linters:
- godox # TODO/etc comments are allowed in our codebase
- funlen # long functions are fine
- wrapcheck # rules around interface-return methods are a bit silly
+ - dogsled # definitely not an issue, ignoring returns is normal
- exhaustruct # tmp: should fix... but too annoying at the moment
- err113 # tmp: will enable when we properly use defined errors
diff --git a/internal/cpu/cpu.go b/internal/cpu/cpu.go
index dd7680cb..41a0c1f9 100644
--- a/internal/cpu/cpu.go
+++ b/internal/cpu/cpu.go
@@ -1,6 +1,8 @@
package cpu
// X86 contains x86 CPU feature flags detected at runtime.
+//
+//nolint:gochecknoglobals
var X86 struct {
HasAVX2 bool
}
diff --git a/internal/cpu/cpu_amd64.go b/internal/cpu/cpu_amd64.go
index f20c810a..7fe59633 100644
--- a/internal/cpu/cpu_amd64.go
+++ b/internal/cpu/cpu_amd64.go
@@ -14,7 +14,7 @@ func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
// xgetbv with ecx = 0 is implemented in cpu_amd64.s.
func xgetbv() (eax, edx uint32)
-func init() {
+func init() { //nolint:gochecknoinits
maxID, _, _, _ := cpuid(0, 0)
if maxID < 7 {
return
@@ -23,6 +23,7 @@ func init() {
_, _, ecx1, _ := cpuid(1, 0)
osSupportsAVX := false
+
if ecx1&cpuidOSXSAVE != 0 {
eax, _ := xgetbv()
osSupportsAVX = eax&(1<<1) != 0 && eax&(1<<2) != 0
diff --git a/receivepack/service/run_hook.go b/receivepack/service/run_hook.go
index 1ab76599..2689edf2 100644
--- a/receivepack/service/run_hook.go
+++ b/receivepack/service/run_hook.go
@@ -48,6 +48,7 @@ func (service *Service) runHook(
err error
)
+ //nolint:nestif
if quarantineName != "" {
quarantineLooseRoot, err = service.opts.ObjectsRoot.OpenRoot(quarantineName)
if err != nil {
diff --git a/refstore/files/batch_apply.go b/refstore/files/batch_apply.go
index 55224b36..b4ba16ad 100644
--- a/refstore/files/batch_apply.go
+++ b/refstore/files/batch_apply.go
@@ -50,6 +50,7 @@ func (batch *Batch) Apply() ([]refstore.BatchResult, error) {
}
seenTargets[targetKey] = struct{}{}
+
remainingIdx = append(remainingIdx, i)
remainingOps = append(remainingOps, op)
}
@@ -87,6 +88,7 @@ func (batch *Batch) Apply() ([]refstore.BatchResult, error) {
}
fatalName := batchResultName(err)
+
fatalMarked := false
for i, idx := range remainingIdx {
if !fatalMarked && remainingOps[i].name == fatalName && fatalName != "" {
@@ -107,6 +109,7 @@ func (batch *Batch) Apply() ([]refstore.BatchResult, error) {
err = executor.commitPreparedUpdates(prepared)
if err != nil {
fatalName := batchResultName(err)
+
fatalMarked := false
for i, idx := range remainingIdx {
if !fatalMarked && remainingOps[i].name == fatalName && fatalName != "" {
diff --git a/refstore/files/transaction_commit.go b/refstore/files/transaction_commit.go
index 4839936a..76bcb195 100644
--- a/refstore/files/transaction_commit.go
+++ b/refstore/files/transaction_commit.go
@@ -2,6 +2,7 @@ package files
func (tx *Transaction) Commit() error {
executor := &refUpdateExecutor{store: tx.store}
+
prepared, err := executor.prepareUpdates(tx.ops)
if err != nil {
return err
diff --git a/refstore/files/update_prepare_lock.go b/refstore/files/update_prepare_lock.go
index d958fc0a..67db9628 100644
--- a/refstore/files/update_prepare_lock.go
+++ b/refstore/files/update_prepare_lock.go
@@ -12,6 +12,7 @@ func (executor *refUpdateExecutor) prepareUpdateLocks(prepared []preparedUpdate)
for _, lockKey := range lockNames {
lockPath := refPathFromKey(lockKey)
+
err := executor.createUpdateLock(lockPath)
if err != nil {
for _, item := range prepared {
diff --git a/refstore/files/update_prepare_resolve.go b/refstore/files/update_prepare_resolve.go
index 492f5157..9e0e92ab 100644
--- a/refstore/files/update_prepare_resolve.go
+++ b/refstore/files/update_prepare_resolve.go
@@ -18,6 +18,7 @@ func (executor *refUpdateExecutor) resolvePreparedUpdates(ops []queuedUpdate) ([
}
targets[targetKey] = struct{}{}
+
prepared = append(prepared, preparedUpdate{op: op, target: target})
}