Skip to content

Commit

Permalink
Merge branch 'master' into action_hash
Browse files Browse the repository at this point in the history
  • Loading branch information
jsimonetti authored Nov 27, 2023
2 parents 2caa712 + 889c07b commit f40ef71
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 8 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: golangci-lint
on:
push:
paths:
- "go.sum"
- "go.mod"
- "**.go"
- ".github/workflows/golangci-lint.yml"
- ".golangci.yml"
pull_request:

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: install Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: 1.21.x
- name: Lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
version: v1.54.2
18 changes: 18 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
linters:
enable:
- gofmt
- misspell
- revive

linters-settings:
misspell:
ignore-words:
# Incorrect spelling used in CacheInfo struct.
- Prefered
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
severity: warning
disabled: true
2 changes: 1 addition & 1 deletion link.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (l *LinkService) Get(index uint32) (LinkMessage, error) {
// RTM_SETLINK because:
// - using RTM_SETLINK is actually an old rtnetlink API, not supporting most
// attributes common today
// - using RTM_NEWLINK is the prefered way to create AND update links
// - using RTM_NEWLINK is the preferred way to create AND update links
// - RTM_NEWLINK is backward compatible to RTM_SETLINK
func (l *LinkService) Set(req *LinkMessage) error {
flags := netlink.Request | netlink.Acknowledge
Expand Down
4 changes: 0 additions & 4 deletions rtnl/addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
//
// iface, _ := net.InterfaceByName("lo")
// conn.AddrAdd(iface, rtnl.MustParseAddr("127.0.0.1/8"))
//
func (c *Conn) AddrAdd(ifc *net.Interface, addr *net.IPNet) error {
af, err := addrFamily(addr.IP)
if err != nil {
Expand Down Expand Up @@ -43,7 +42,6 @@ func (c *Conn) AddrAdd(ifc *net.Interface, addr *net.IPNet) error {
//
// iface, _ := net.InterfaceByName("lo")
// conn.AddrDel(iface, rtnl.MustParseAddr("127.0.0.1/8"))
//
func (c *Conn) AddrDel(ifc *net.Interface, addr *net.IPNet) error {
af, err := addrFamily(addr.IP)
if err != nil {
Expand Down Expand Up @@ -79,7 +77,6 @@ func (c *Conn) AddrDel(ifc *net.Interface, addr *net.IPNet) error {
// To retrieve all addresses configured for the system, run:
//
// conn.Addrs(nil, 0)
//
func (c *Conn) Addrs(ifc *net.Interface, family int) (out []*net.IPNet, err error) {
rx, err := c.Conn.Address.List()
if err != nil {
Expand Down Expand Up @@ -136,7 +133,6 @@ func ParseAddr(s string) (*net.IPNet, error) {
//
// iface, _ := net.InterfaceByName("enp2s0")
// conn.AddrDel(iface, rtnl.MustParseAddr("10.1.1.1/24"))
//
func MustParseAddr(s string) *net.IPNet {
n, err := ParseAddr(s)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions rtnl/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ type Conn struct {
}

// Dial the netlink socket. Establishes a new connection. The typical initialisation is:
// conn, err := rtnl.Dial(nil)
//
// conn, err := rtnl.Dial(nil)
// if err != nil {
// log.Fatal("can't establish netlink connection: ", err)
// }
// defer conn.Close()
// // use conn for your calls
//
func Dial(cfg *netlink.Config) (*Conn, error) {
conn, err := rtnetlink.Dial(cfg)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion rtnl/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func genRouteMessage(ifc *net.Interface, dst net.IPNet, gw net.IP, options ...Ro
return tx, nil
}

// RouteAdd adds infomation about a network route.
// RouteAdd adds information about a network route.
func (c *Conn) RouteAdd(ifc *net.Interface, dst net.IPNet, gw net.IP, options ...RouteOption) (err error) {
rm, err := genRouteMessage(ifc, dst, gw, options...)
if err != nil {
Expand Down

0 comments on commit f40ef71

Please sign in to comment.