Skip to content

Commit

Permalink
fix: Same name as predeclared identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
jachym-tousek-keboola committed Sep 30, 2024
1 parent a903192 commit 1f8b767
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions internal/pkg/service/common/errors/countlimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ type CountLimitReachedError struct {
in string
}

func NewCountLimitReachedError(what string, max int, in string) CountLimitReachedError {
return CountLimitReachedError{what: what, max: max, in: in}
func NewCountLimitReachedError(what string, maximum int, in string) CountLimitReachedError {
return CountLimitReachedError{what: what, max: maximum, in: in}
}

func (e CountLimitReachedError) ErrorName() string {
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/service/common/etcdop/op/atomic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func TestAtomicUpdate(t *testing.T) {
var logger strings.Builder

// Create atomic update operation
var beforeUpdate func() (clear bool)
var beforeUpdate func() (clearCallback bool)
var valueFromGetPhase string
var result string
atomicOp := op.Atomic(client, &result)
Expand Down Expand Up @@ -496,7 +496,7 @@ func TestAtomicUpdate(t *testing.T) {
assert.Equal(t, "<<value>>", string(r.Value))

// 3. Modification during update, DoWithoutRetry, fail
beforeUpdate = func() (clear bool) {
beforeUpdate = func() (clearCallback bool) {
require.NoError(t, key1.Put(client, "newValue1").Do(ctx).Err())
return true
}
Expand All @@ -508,7 +508,7 @@ func TestAtomicUpdate(t *testing.T) {
assert.Equal(t, "newValue1", string(r.Value))

// 4. Modification during update, Do, fail
beforeUpdate = func() (clear bool) {
beforeUpdate = func() (clearCallback bool) {
require.NoError(t, key1.Put(client, "newValue3").Do(ctx).Err())
return false
}
Expand All @@ -521,7 +521,7 @@ func TestAtomicUpdate(t *testing.T) {
assert.Equal(t, "newValue3", string(r.Value))

// 5. Modification during update, Do, success
beforeUpdate = func() (clear bool) {
beforeUpdate = func() (clearCallback bool) {
require.NoError(t, key1.Put(client, "newValue2").Do(ctx).Err())
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ func (n *CoordinatorNode) invokeListeners() {
}
}

func greaterOrEqual(actual, min int64) bool {
return actual == NoSourceNode || actual >= min
func greaterOrEqual(actual, minimum int64) bool {
return actual == NoSourceNode || actual >= minimum
}
6 changes: 3 additions & 3 deletions internal/pkg/utils/strhelper/strhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ func StripHTMLComments(str string) string {
})
}

func Truncate(str string, max int, suffix string) string {
if len(str) <= max {
func Truncate(str string, maximum int, suffix string) string {
if len(str) <= maximum {
return str
}
return str[0:max] + suffix
return str[0:maximum] + suffix
}

// NormalizeName converts any string into kebab-case.
Expand Down
6 changes: 3 additions & 3 deletions pkg/lib/operation/project/remote/table/preview/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ func renderPretty(table *keboola.TablePreview, adaptWidth bool) string {

var b strings.Builder

truncate := func(s string, max int) string {
if !adaptWidth || len(s) <= max {
truncate := func(s string, maximum int) string {
if !adaptWidth || len(s) <= maximum {
return s
}
return fmt.Sprintf("%s...", s[:max-3])
return fmt.Sprintf("%s...", s[:maximum-3])
}
// draws a "border" line, e.g. `┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┓`
border := func(left, middle, right string, lf bool) {
Expand Down

0 comments on commit 1f8b767

Please sign in to comment.