Skip to content

Commit

Permalink
Sync with gitlab (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncsibra authored Mar 8, 2022
1 parent da16514 commit 0cad7d0
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 87 deletions.
67 changes: 0 additions & 67 deletions .editorconfig

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI
on: [push, workflow_dispatch]

jobs:
test:
runs-on: ubuntu-latest
container: golang:1.17
steps:
- uses: actions/checkout@v2

- run: go test -mod=readonly -race -v ./...

verify:
if: github.ref_type == 'branch' && github.ref_name != 'master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- run: ./verify.sh

build:
runs-on: ubuntu-latest
container: golang:1.17
steps:
- uses: actions/checkout@v2

- run: go build -a -mod=readonly -o /dev/null ./...

lint:
runs-on: ubuntu-latest
container: golang:1.17
steps:
- uses: actions/checkout@v2

- uses: golangci/golangci-lint-action@v2
with:
version: v1.44.2
args: -c .golangci.yml
22 changes: 15 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 1m

timeout: 1m
# include test files or not, default is true
tests: true

# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
Expand All @@ -20,14 +20,14 @@ linters:
enable:
- deadcode
- errcheck
- exportloopref
- goconst
- goimports
- golint
- revive
- gosec
- govet
- ineffassign
- prealloc
- scopelint
- staticcheck
- structcheck
- typecheck
Expand All @@ -48,9 +48,17 @@ issues:
# excluded by default patterns execute `golangci-lint run --help`
exclude:
- "declaration of \"err\" shadows declaration at"

- "Consider preallocating `details`"
- "Consider preallocating `publicDetails`"
- "`ctx` is unused"

exclude-rules:
- path: _test\.go
linters:
- goconst

# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-per-linter: 0

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes

## v1.1.0 / 2022-03-08
- sync with gitlab

## v1.0.1 / 2020-11-23
- migrated to GitHub

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019
Copyright (c) 2022 Pro Emergotech Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Shallow-go
==============================
[![Go Reference](https://pkg.go.dev/badge/github.com/proemergotech/shallow.svg)](https://pkg.go.dev/github.com/proemergotech/shallow)
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module github.com/proemergotech/shallow

go 1.15
go 1.17

require (
github.com/kr/pretty v0.1.0
github.com/pkg/errors v0.8.1
github.com/proemergotech/errors/v2 v2.0.0
)

require github.com/kr/text v0.1.0 // indirect
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/proemergotech/errors/v2 v2.0.0 h1:wNHZOMnDV95Su5jseNlopKv5kxv2f41frl3enghl/jo=
github.com/proemergotech/errors/v2 v2.0.0/go.mod h1:gCeVJJcI1aU2BiaN/N99Fmd6CDsIRXMGOht80M3cWEg=
2 changes: 1 addition & 1 deletion shallow.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"strings"

"github.com/pkg/errors"
"github.com/proemergotech/errors/v2"
)

type options struct {
Expand Down
2 changes: 1 addition & 1 deletion shallow_diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/kr/pretty"
"github.com/pkg/errors"
"github.com/proemergotech/errors/v2"
)

func TestDiff(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion shallow_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/kr/pretty"
"github.com/pkg/errors"
"github.com/proemergotech/errors/v2"
)

func TestMerge(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion shallow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

"github.com/kr/pretty"
"github.com/pkg/errors"
"github.com/proemergotech/errors/v2"
)

type test struct {
Expand Down
11 changes: 9 additions & 2 deletions verify.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#!/bin/sh
# Check for CHANGELOG updates and fails when not found

changelog_filename="CHANGELOG.md"

git fetch --depth 1 origin master

if ! git diff --name-only origin/master | grep -E '.*\.go|go.mod|go.sum'
then
echo "Go code change not found."
exit 0
fi

if [ -f ${changelog_filename} ]
then
if [ "$(git diff --name-only origin/master -- ${changelog_filename} | grep -cw ${changelog_filename})" -ne 1 ]
then
echo "Changelog should be updated!"
exit 1
fi
fi
fi

0 comments on commit 0cad7d0

Please sign in to comment.