Skip to content

Commit cf04722

Browse files
committed
Bump go 1.19.6
This bump up go into 1.19.6 and fixes lint errors generated in CI after upgrading go version. Signed-off-by: Periyasamy Palanisamy <[email protected]>
1 parent c287d43 commit cf04722

File tree

12 files changed

+49
-50
lines changed

12 files changed

+49
-50
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414

15-
- name: Set up Go 1.18
16-
uses: actions/setup-go@v2
15+
- name: Set up Go 1.19.6
16+
uses: actions/setup-go@v3
1717
with:
18-
go-version: 1.18
18+
go-version: 1.19.6
1919
id: go
2020

2121
- name: Install benchstat
@@ -82,10 +82,10 @@ jobs:
8282
runs-on: ubuntu-latest
8383

8484
steps:
85-
- name: Set up Go 1.18
86-
uses: actions/setup-go@v1
85+
- name: Set up Go 1.19.6
86+
uses: actions/setup-go@v3
8787
with:
88-
go-version: 1.18
88+
go-version: 1.19.6
8989
id: go
9090

9191
- name: Check out code into the Go module directory

cache/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Package cache provides a cache of model.Model elements that can be used in an OV
33
44
The cache can be accessed using a simple API:
55
6-
cache.Table("Open_vSwitch").Row("<ovs-uuid>")
6+
cache.Table("Open_vSwitch").Row("<ovs-uuid>")
77
88
It implements the ovsdb.NotificationHandler interface
99
such that it can be populated automatically by

client/api_test_model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (*testLogicalSwitch) Table() string {
128128
return "Logical_Switch"
129129
}
130130

131-
//LogicalSwitchPort struct defines an object in Logical_Switch_Port table
131+
// LogicalSwitchPort struct defines an object in Logical_Switch_Port table
132132
type testLogicalSwitchPort struct {
133133
UUID string `ovsdb:"_uuid"`
134134
Up *bool `ovsdb:"up"`

client/doc.go

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,29 @@ Package client connects to, monitors and interacts with OVSDB servers (RFC7047).
44
This package uses structs, that contain the 'ovs' field tag to determine which field goes to
55
which column in the database. We refer to pointers to this structs as Models. Example:
66
7-
type MyLogicalSwitch struct {
8-
UUID string `ovsdb:"_uuid"` // _uuid tag is mandatory
9-
Name string `ovsdb:"name"`
10-
Ports []string `ovsdb:"ports"`
11-
Config map[string]string `ovsdb:"other_config"`
12-
}
7+
type MyLogicalSwitch struct {
8+
UUID string `ovsdb:"_uuid"` // _uuid tag is mandatory
9+
Name string `ovsdb:"name"`
10+
Ports []string `ovsdb:"ports"`
11+
Config map[string]string `ovsdb:"other_config"`
12+
}
1313
1414
Based on these Models a Database Model (see ClientDBModel type) is built to represent
1515
the entire OVSDB:
1616
17-
clientDBModel, _ := client.NewClientDBModel("OVN_Northbound",
18-
map[string]client.Model{
19-
"Logical_Switch": &MyLogicalSwitch{},
20-
})
21-
17+
clientDBModel, _ := client.NewClientDBModel("OVN_Northbound",
18+
map[string]client.Model{
19+
"Logical_Switch": &MyLogicalSwitch{},
20+
})
2221
2322
The ClientDBModel represents the entire Database (or the part of it we're interested in).
2423
Using it, the libovsdb.client package is able to properly encode and decode OVSDB messages
2524
and store them in Model instances.
2625
A client instance is created by simply specifying the connection information and the database model:
2726
28-
ovs, _ := client.Connect(context.Background(), clientDBModel)
27+
ovs, _ := client.Connect(context.Background(), clientDBModel)
2928
30-
Main API
29+
# Main API
3130
3231
After creating a OvsdbClient using the Connect() function, we can use a number of CRUD-like
3332
to interact with the database:
@@ -43,7 +42,7 @@ and passed to client.Transact().
4342
Others, such as List() and Get(), interact with the client's internal cache and are able to
4443
return Model instances (or a list thereof) directly.
4544
46-
Conditions
45+
# Conditions
4746
4847
Some API functions (Create() and Get()), can be run directly. Others, require us to use
4948
a ConditionalAPI. The ConditionalAPI injects RFC7047 Conditions into ovsdb Operations as well as
@@ -111,15 +110,15 @@ cache element, an operation will be created matching on the "_uuid" column. The
111110
quite large depending on the cache size and the provided function. Most likely there is a way to express the
112111
same condition using Where() or WhereAll() which will be more efficient.
113112
114-
Get
113+
# Get
115114
116115
Get() operation is a simple operation capable of retrieving one Model based on some of its schema indexes. E.g:
117116
118117
ls := &LogicalSwitch{UUID:"myUUID"}
119118
err := ovs.Get(ls)
120119
fmt.Printf("Name of the switch is: &s", ls.Name)
121120
122-
List
121+
# List
123122
124123
List() searches the cache and populates a slice of Models. It can be used directly or using WhereCache()
125124
@@ -131,7 +130,7 @@ List() searches the cache and populates a slice of Models. It can be used direct
131130
return strings.HasPrefix(ls.Name, "ext_")
132131
}).List(lsList)
133132
134-
Create
133+
# Create
135134
136135
Create returns a list of operations to create the models provided. E.g:
137136
@@ -143,7 +142,7 @@ Update returns a list of operations to update the matching rows to match the val
143142
ls := &LogicalSwitch{ExternalIDs: map[string]string {"foo": "bar"}}
144143
ops, err := ovs.Where(...).Update(&ls, &ls.ExternalIDs}
145144
146-
Mutate
145+
# Mutate
147146
148147
Mutate returns a list of operations needed to mutate the matching rows as described by the list of Mutation objects. E.g:
149148
@@ -154,11 +153,10 @@ Mutate returns a list of operations needed to mutate the matching rows as descri
154153
Value: map[string]string{"foo":"bar"},
155154
})
156155
157-
Delete
156+
# Delete
158157
159158
Delete returns a list of operations needed to delete the matching rows. E.g:
160159
161160
ops, err := ovs.Where(...).Delete()
162-
163161
*/
164162
package client

cmd/modelgen/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"encoding/json"
55
"flag"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"log"
99
"os"
1010
"path/filepath"
@@ -56,7 +56,7 @@ func main() {
5656
}
5757
defer schemaFile.Close()
5858

59-
schemaBytes, err := ioutil.ReadAll(schemaFile)
59+
schemaBytes, err := io.ReadAll(schemaFile)
6060
if err != nil {
6161
log.Fatal(err)
6262
}

cmd/print_schema/print_schema.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"encoding/json"
55
"flag"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"log"
99
"os"
1010
"runtime"
@@ -53,7 +53,7 @@ func main() {
5353
}
5454
defer schemaFile.Close()
5555

56-
schemaBytes, err := ioutil.ReadAll(schemaFile)
56+
schemaBytes, err := io.ReadAll(schemaFile)
5757
if err != nil {
5858
log.Fatal(err)
5959
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ovn-org/libovsdb
22

3-
go 1.18
3+
go 1.19
44

55
require (
66
github.com/cenkalti/backoff/v4 v4.1.3

mapper/mapper.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ import (
1212
// to what column in the database id through field a field tag.
1313
// The tag used is "ovsdb" and has the following structure
1414
// 'ovsdb:"${COLUMN_NAME}"'
15+
//
1516
// where COLUMN_NAME is the name of the column and must match the schema
1617
//
17-
//Example:
18-
// type MyObj struct {
19-
// Name string `ovsdb:"name"`
20-
// }
18+
// Example:
19+
//
20+
// type MyObj struct {
21+
// Name string `ovsdb:"name"`
22+
// }
2123
type Mapper struct {
2224
Schema ovsdb.DatabaseSchema
2325
}

model/model.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ import (
1616
// The struct may also have non-tagged fields (which will be ignored by the API calls)
1717
// The Model interface must be implemented by the pointer to such type
1818
// Example:
19-
//type MyLogicalRouter struct {
20-
// UUID string `ovsdb:"_uuid"`
21-
// Name string `ovsdb:"name"`
22-
// ExternalIDs map[string]string `ovsdb:"external_ids"`
23-
// LoadBalancers []string `ovsdb:"load_balancer"`
24-
//}
19+
//
20+
// type MyLogicalRouter struct {
21+
// UUID string `ovsdb:"_uuid"`
22+
// Name string `ovsdb:"name"`
23+
// ExternalIDs map[string]string `ovsdb:"external_ids"`
24+
// LoadBalancers []string `ovsdb:"load_balancer"`
25+
// }
2526
type Model interface{}
2627

2728
type CloneableModel interface {

modelgen/doc.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
Package modelgen provides core functionality to implement Model code generators based on a schema.
33
44
It allows to create and customize a text/template that can generate the Model types that libovsdb can work with.
5-
65
*/
76
package modelgen

modelgen/generator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"bytes"
55
"fmt"
66
"go/format"
7-
"io/ioutil"
87
"log"
8+
"os"
99
"text/template"
1010
)
1111

@@ -47,11 +47,11 @@ func (g *generator) Generate(filename string, tmpl *template.Template, args inte
4747
fmt.Print("\n")
4848
return nil
4949
}
50-
content, err := ioutil.ReadFile(filename)
50+
content, err := os.ReadFile(filename)
5151
if err == nil && bytes.Equal(content, src) {
5252
return nil
5353
}
54-
return ioutil.WriteFile(filename, src, 0644)
54+
return os.WriteFile(filename, src, 0644)
5555
}
5656

5757
// NewGenerator returns a new Generator

ovsdb/schema.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"fmt"
66
"io"
7-
"io/ioutil"
87
"math"
98
"os"
109
"strings"
@@ -48,7 +47,7 @@ func (schema DatabaseSchema) Print(w io.Writer) {
4847

4948
// SchemaFromFile returns a DatabaseSchema from a file
5049
func SchemaFromFile(f *os.File) (DatabaseSchema, error) {
51-
data, err := ioutil.ReadAll(f)
50+
data, err := io.ReadAll(f)
5251
if err != nil {
5352
return DatabaseSchema{}, err
5453
}
@@ -124,7 +123,7 @@ of this library, we define an ExtendedType that includes all possible column typ
124123
atomic fields).
125124
*/
126125

127-
//ExtendedType includes atomic types as defined in the RFC plus Enum, Map and Set
126+
// ExtendedType includes atomic types as defined in the RFC plus Enum, Map and Set
128127
type ExtendedType = string
129128

130129
// RefType is used to define the possible RefTypes

0 commit comments

Comments
 (0)