-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update golangci-lint action to go through all dirs if no working dire…
…ctory set
- Loading branch information
Showing
6 changed files
with
172 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
run: | ||
timeout: 15m0s | ||
allow-parallel-runners: true | ||
allow-serial-runners: true | ||
linters: | ||
enable: | ||
- containedctx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package ccip | ||
|
||
import ( | ||
"sync" | ||
"testing" | ||
) | ||
|
||
func TestFail(t *testing.T) { | ||
if testing.Short() { | ||
t.Skip() | ||
} | ||
t.Fatal("fake failure") | ||
} | ||
|
||
func TestRace(t *testing.T) { | ||
var v int | ||
var wg sync.WaitGroup | ||
wg.Add(100) | ||
for i := 0; i < 100; i++ { | ||
go func() { | ||
defer wg.Done() | ||
v++ | ||
v-- | ||
}() | ||
} | ||
wg.Wait() | ||
t.Log(v) | ||
} | ||
|
||
// func TestLint(t *testing.T) { | ||
// const v1 = (true && false) && (true && false) // SQ Identical expressions should not be used on both sides of a binary operator | ||
// a := 1 | ||
// if !(a == 2) { // SQ boolean check should not be inverted | ||
// } | ||
// const UnusedVar = 1 // lint should complain for unused variable | ||
// const ALL_CAPS = 10 // should be AllCaps | ||
// err := os.ErrNotExist | ||
// if err == os.ErrNotExist { // should use errors.Is | ||
// err := errors.New("fake error") // shadowed variable | ||
// t.Log(err) | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package core | ||
|
||
import ( | ||
"sync" | ||
"testing" | ||
) | ||
|
||
func TestFail(t *testing.T) { | ||
if testing.Short() { | ||
t.Skip() | ||
} | ||
t.Fatal("fake failure") | ||
} | ||
|
||
func TestRace(t *testing.T) { | ||
var v int | ||
var wg sync.WaitGroup | ||
wg.Add(100) | ||
for i := 0; i < 100; i++ { | ||
go func() { | ||
defer wg.Done() | ||
v++ | ||
v-- | ||
}() | ||
} | ||
wg.Wait() | ||
t.Log(v) | ||
} | ||
|
||
// func TestLint(t *testing.T) { | ||
// const v1 = (true && false) && (true && false) // SQ Identical expressions should not be used on both sides of a binary operator | ||
// a := 1 | ||
// if !(a == 2) { // SQ boolean check should not be inverted | ||
// } | ||
// const UnusedVar = 1 // lint should complain for unused variable | ||
// const ALL_CAPS = 10 // should be AllCaps | ||
// err := os.ErrNotExist | ||
// if err == os.ErrNotExist { // should use errors.Is | ||
// err := errors.New("fake error") // shadowed variable | ||
// t.Log(err) | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package deployment | ||
|
||
import ( | ||
"errors" | ||
"os" | ||
"sync" | ||
"testing" | ||
) | ||
|
||
func TestFail(t *testing.T) { | ||
if testing.Short() { | ||
t.Skip() | ||
} | ||
t.Fatal("fake failure") | ||
} | ||
|
||
func TestRace(t *testing.T) { | ||
var v int | ||
var wg sync.WaitGroup | ||
wg.Add(100) | ||
for i := 0; i < 100; i++ { | ||
go func() { | ||
defer wg.Done() | ||
v++ | ||
v-- | ||
}() | ||
} | ||
wg.Wait() | ||
t.Log(v) | ||
} | ||
|
||
func TestLint(t *testing.T) { | ||
const v1 = (true && false) && (true && false) // SQ Identical expressions should not be used on both sides of a binary operator | ||
a := 1 | ||
if !(a == 2) { // SQ boolean check should not be inverted | ||
} | ||
const UnusedVar = 1 // lint should complain for unused variable | ||
const ALL_CAPS = 10 // should be AllCaps | ||
err := os.ErrNotExist | ||
if err == os.ErrNotExist { // should use errors.Is | ||
err := errors.New("fake error") // shadowed variable | ||
t.Log(err) | ||
} | ||
} |