Skip to content

Commit ff1ea42

Browse files
committed
Initial commit
0 parents  commit ff1ea42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+14646
-0
lines changed

.github/workflows/lint.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
golangci:
9+
name: golangci-lint
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: '1.24'
20+
21+
- name: Run golangci-lint
22+
uses: golangci/golangci-lint-action@v6
23+
with:
24+
version: latest
25+
args: --timeout=5m
26+
27+
format:
28+
name: Check formatting
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Set up Go
36+
uses: actions/setup-go@v5
37+
with:
38+
go-version: '1.24'
39+
40+
- name: Check formatting
41+
run: |
42+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
43+
echo "Code is not formatted. Run 'make fmt' to fix."
44+
gofmt -s -l .
45+
exit 1
46+
fi

.github/workflows/security.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Security
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
# Run weekly on Monday at 00:00 UTC
8+
- cron: '0 0 * * 1'
9+
10+
jobs:
11+
gosec:
12+
name: gosec security scan
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '1.24'
23+
24+
- name: Run gosec
25+
uses: securego/gosec@master
26+
with:
27+
args: '-fmt sarif -out results.sarif ./...'
28+
29+
- name: Upload SARIF file
30+
uses: github/codeql-action/upload-sarif@v3
31+
with:
32+
sarif_file: results.sarif
33+
34+
govulncheck:
35+
name: Go vulnerability check
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
42+
- name: Set up Go
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version: '1.24'
46+
47+
- name: Install govulncheck
48+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
49+
50+
- name: Run govulncheck
51+
run: govulncheck ./...

.github/workflows/test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
name: Test
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
go-version: ['1.24', '1.25']
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: ${{ matrix.go-version }}
23+
24+
- name: Get dependencies
25+
run: go mod download
26+
27+
- name: Verify dependencies
28+
run: go mod verify
29+
30+
- name: Build
31+
run: go build -v ./...
32+
33+
- name: Run tests
34+
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
35+
36+
- name: Upload coverage to Codecov
37+
if: matrix.go-version == '1.24'
38+
uses: codecov/codecov-action@v4
39+
with:
40+
files: ./coverage.out
41+
flags: unittests
42+
name: codecov-go-netconf

.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool
12+
*.out
13+
coverage.out
14+
coverage.html
15+
16+
# Dependency directories
17+
vendor/
18+
19+
# Go workspace file
20+
go.work
21+
go.work.sum
22+
23+
# IDE files
24+
.vscode/
25+
.idea/
26+
*.swp
27+
*.swo
28+
*~
29+
.DS_Store
30+
31+
# Build artifacts
32+
bin/
33+
dist/
34+
35+
# Project files
36+
project/

.golangci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# golangci-lint v2.x configuration
2+
# Reference: https://golangci-lint.run/usage/configuration/
3+
4+
version: 2
5+
6+
run:
7+
timeout: 5m
8+
tests: true
9+
modules-download-mode: readonly
10+
skip-dirs:
11+
- examples
12+
13+
output:
14+
format: colored-line-number
15+
print-issued-lines: true
16+
print-linter-name: true
17+
sort-results: true
18+
19+
linters:
20+
enable:
21+
# Enabled by default - explicitly listed for clarity
22+
- errcheck # Check for unchecked errors
23+
- govet # Vet examines Go source code
24+
- ineffassign # Detect ineffectual assignments
25+
- staticcheck # Static analysis (includes gosimple, stylecheck in v2.x)
26+
- unused # Check for unused code
27+
28+
# Code quality linters
29+
- misspell # Check for misspelled words
30+
- goconst # Find repeated strings that could be constants
31+
- gocyclo # Check cyclomatic complexity
32+
- dupl # Check for duplicated code
33+
- revive # Comprehensive code quality checks
34+
35+
# Specific checks
36+
- gosec # Security checks
37+
38+
# Note: Code formatting (gofmt, goimports) is checked separately in CI workflow
39+
40+
linters-settings:
41+
errcheck:
42+
check-type-assertions: true
43+
check-blank: true
44+
45+
govet:
46+
enable-all: true
47+
disable:
48+
- shadow # Can be noisy in some cases
49+
50+
gocyclo:
51+
min-complexity: 15
52+
53+
dupl:
54+
threshold: 100
55+
56+
goconst:
57+
min-len: 3
58+
min-occurrences: 3
59+
60+
misspell:
61+
locale: US
62+
63+
revive:
64+
confidence: 0.8
65+
66+
issues:
67+
exclude-dirs:
68+
- examples
69+
70+
exclude-rules:
71+
# Exclude some linters from running on test files
72+
- path: _test\.go
73+
linters:
74+
- gocyclo
75+
- dupl
76+
- gosec
77+
- revive
78+
- errcheck
79+
80+
# Exclude examples from all strict checking (examples are for demonstration)
81+
- path: examples/.*\.go
82+
linters:
83+
- errcheck
84+
- gosec
85+
- revive
86+
- unused
87+
88+
max-issues-per-linter: 0
89+
max-same-issues: 0

.gosec.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# gosec configuration
2+
# Reference: https://github.com/securego/gosec
3+
4+
# Global settings
5+
global:
6+
# Fail on medium severity issues
7+
nosec: false
8+
# Show ignored issues
9+
show-ignored: false
10+
# Confidence level (low, medium, high)
11+
confidence: medium
12+
# Severity level (low, medium, high)
13+
severity: medium
14+
15+
# Exclude rules
16+
exclude:
17+
# G104: Audit errors not checked - covered by errcheck linter
18+
- G104
19+
20+
# Exclude directories
21+
exclude-dir:
22+
- vendor
23+
24+
# Include test files
25+
tests: true
26+
27+
# Output format
28+
fmt: text
29+
30+
# Enable all rules by default
31+
enable-all: true

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [unreleased]
9+
10+
### Added
11+
12+
- Initial release

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by sending an email to [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

0 commit comments

Comments
 (0)