forked from Azure/azure-container-networking
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add golint-ci * add gofmt * enable linters * uncap count * fix linting/fmt issues
- Loading branch information
Showing
44 changed files
with
525 additions
and
475 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.go text eol=lf |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: golangci-lint | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
schedule: | ||
# run once a day at midnight | ||
- cron: '0 0 * * *' | ||
jobs: | ||
golangci: | ||
strategy: | ||
matrix: | ||
go-version: [1.16.x] | ||
os: [ubuntu-latest, windows-latest] | ||
name: Lint | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. | ||
version: v1.40 | ||
# Optional: working directory, useful for monorepos | ||
# working-directory: somedir | ||
|
||
# Optional: golangci-lint command line arguments. | ||
# args: --issues-exit-code=0 | ||
args: --timeout=5m | ||
|
||
# Optional: show only new issues if it's a pull request. The default value is `false`. | ||
only-new-issues: true |
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,24 @@ | ||
issues: | ||
max-same-issues: 0 | ||
max-issues-per-linter: 0 | ||
|
||
enable: | ||
- bodyclose | ||
- deadcode | ||
- errcheck | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- golint | ||
- gomnd | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- interfacer | ||
- lll | ||
- misspell | ||
- nakedret |
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,20 +1,20 @@ | ||
package network | ||
|
||
import ( | ||
"net" | ||
|
||
"github.com/Azure/azure-container-networking/cni" | ||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current" | ||
) | ||
|
||
// IPAMInvoker is used by the azure-vnet CNI plugin to call different sources for IPAM. | ||
// This interface can be used to call into external binaries, like the azure-vnet-ipam binary, | ||
// or simply act as a client to an external ipam, such as azure-cns. | ||
type IPAMInvoker interface { | ||
|
||
//Add returns two results, one IPv4, the other IPv6. | ||
Add(nwCfg *cni.NetworkConfig, subnetPrefix *net.IPNet, options map[string]interface{}) (*cniTypesCurr.Result, *cniTypesCurr.Result, error) | ||
|
||
//Delete calls to the invoker source, and returns error. Returning an error here will fail the CNI Delete call. | ||
Delete(address *net.IPNet, nwCfg *cni.NetworkConfig, options map[string]interface{}) error | ||
} | ||
package network | ||
|
||
import ( | ||
"net" | ||
|
||
"github.com/Azure/azure-container-networking/cni" | ||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current" | ||
) | ||
|
||
// IPAMInvoker is used by the azure-vnet CNI plugin to call different sources for IPAM. | ||
// This interface can be used to call into external binaries, like the azure-vnet-ipam binary, | ||
// or simply act as a client to an external ipam, such as azure-cns. | ||
type IPAMInvoker interface { | ||
|
||
//Add returns two results, one IPv4, the other IPv6. | ||
Add(nwCfg *cni.NetworkConfig, subnetPrefix *net.IPNet, options map[string]interface{}) (*cniTypesCurr.Result, *cniTypesCurr.Result, error) | ||
|
||
//Delete calls to the invoker source, and returns error. Returning an error here will fail the CNI Delete call. | ||
Delete(address *net.IPNet, nwCfg *cni.NetworkConfig, options map[string]interface{}) error | ||
} |
Oops, something went wrong.