Skip to content

Commit

Permalink
Migrate to go 1.14
Browse files Browse the repository at this point in the history
  • Loading branch information
knl committed May 22, 2020
1 parent 332cf1b commit 6a7b774
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: 1.13.x
go-version: 1.14.x
- uses: actions/cache@v1
id: cache
with:
Expand All @@ -43,7 +43,7 @@ jobs:
strategy:
matrix:
go-version:
- 1.13.x
- 1.14.x
os:
- macos-latest
- ubuntu-latest
Expand All @@ -53,7 +53,7 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- uses: actions/cache@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: 1.13.x
go-version: 1.14.x
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ linters:
- lll
- funlen # TODO: remove
- gomnd
- goerr113 # TODO: remove would be good to have modern error handling
- testpackage # I want to test internal methods
presets:
- bugs
- unused
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/knl/pulley

go 1.13
go 1.14

require (
github.com/google/go-github/v29 v29.0.2
Expand Down
6 changes: 3 additions & 3 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func parseStrategy(in string) (TimingStrategy, error) {
return 0, fmt.Errorf("could not translate '%s' into an appropriate strategy (allowed values: %v)", in, allowed)
}

type Config struct { // nolint
type Config struct {
Host string // PULLEY_HOST
Port string // PULLEY_PORT
WebhookPath string // PULLEY_WEBHOOK_PATH
Expand Down Expand Up @@ -179,7 +179,7 @@ func configStrategies(config *Config) (*Config, error) {
return config, nil
}

// Setup configurations with environment variables
// Setup configurations with environment variables.
func Setup() (*Config, error) {
config := DefaultConfig()

Expand Down Expand Up @@ -237,7 +237,7 @@ var aggregateOutputTmpl = `
{{end}}
`

// Returns a string containing the configuration, useful for logging
// Returns a string containing the configuration, useful for logging.
func (config *Config) Print() (string, error) {
t := template.Must(template.New("config").Funcs(template.FuncMap{
"dequote": func(s string) string {
Expand Down
6 changes: 3 additions & 3 deletions internal/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func ParseStatus(in string) (Status, error) {
return 0, fmt.Errorf("could not translate '%s' into a Status", in)
}

// When there is an update to a Pull Request, such as creation, closing, re-opening
// When there is an update to a Pull Request, such as creation, closing, re-opening.
type PullUpdate struct {
Repo string
Action PREvent
Expand All @@ -114,7 +114,7 @@ type PullUpdate struct {
}

// When the branch has been updated, either due to a push or force-push
// Not interested in closing, that PullUpdate handles
// Not interested in closing, that PullUpdate handles.
type BranchUpdate struct {
Repo string
Action BranchEvent
Expand All @@ -123,7 +123,7 @@ type BranchUpdate struct {
Timestamp time.Time
}

// When we get a status notification from CI
// When we get a status notification from CI.
type CommitUpdate struct {
Repo string
Status Status
Expand Down
10 changes: 5 additions & 5 deletions internal/service/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ func collectKeys(database map[Key]float64, metric string) []Key {
}

// SETUP
// Importantly you need to call Run() once you've done what you need
// Importantly you need to call Run() once you've done what you need.
func TestMain(m *testing.M) {
log.SetOutput(ioutil.Discard)
os.Exit(m.Run())
}

// If only PullEvents occur, there should be no other events detected
// If only PullEvents occur, there should be no other events detected.
func TestPullEventsRecognized(t *testing.T) {
m := fakeMetrics{
database: make(map[Key]float64),
Expand Down Expand Up @@ -113,7 +113,7 @@ func TestPullEventsRecognized(t *testing.T) {
assert.Empty(collectKeys(m.database, "commit_event"))
}

// If only BranchEvents occur, there should be no other events detected
// If only BranchEvents occur, there should be no other events detected.
func TestBranchEventsRecognized(t *testing.T) {
m := fakeMetrics{
database: make(map[Key]float64),
Expand Down Expand Up @@ -144,7 +144,7 @@ func TestBranchEventsRecognized(t *testing.T) {
}

// Correctly count CI validation times
// Send a new PR event, CI pending, CI success
// Send a new PR event, CI pending, CI success.
func TestCIValidationWithPending(t *testing.T) {
m := fakeMetrics{
database: make(map[Key]float64),
Expand Down Expand Up @@ -196,7 +196,7 @@ func TestCIValidationWithPending(t *testing.T) {
}

// Correctly count CI validation times
// Send a new PR event, straight to CI success
// Send a new PR event, straight to CI success.
func TestCIValidationWithoutPending(t *testing.T) {
m := fakeMetrics{
database: make(map[Key]float64),
Expand Down
2 changes: 1 addition & 1 deletion lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -Eeuo pipefail

if [[ ! -x "$GOBIN/golangci-lint" ]]; then
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$GOBIN" v1.23.3
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$GOBIN" v1.27.0
fi

"$GOBIN/golangci-lint" run

0 comments on commit 6a7b774

Please sign in to comment.