Skip to content

Commit 4eb0989

Browse files
author
Youen Péron
authored
chore: upgrade devcontainer
2 parents 61e4af1 + b372513 commit 4eb0989

File tree

11 files changed

+829
-295
lines changed

11 files changed

+829
-295
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with LINO. If not, see <http://www.gnu.org/licenses/>.
1717

18-
FROM adrienaury/go-devcontainer:v0.3.1-debian
18+
FROM adrienaury/go-devcontainer:v0.5.1-debian
1919

2020
USER root
2121

go.mod

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
11
module github.com/cgi-fr/lino
22

3-
go 1.13
3+
go 1.17
44

55
require (
66
github.com/Trendyol/overlog v0.1.0
7-
github.com/awalterschulze/gographviz v0.0.0-20190522210029-fa59802746ab
8-
github.com/docker/docker-credential-helpers v0.6.3
9-
github.com/go-sql-driver/mysql v1.5.0 // indirect
10-
github.com/godror/godror v0.20.8
11-
github.com/gorilla/mux v1.7.4
7+
github.com/awalterschulze/gographviz v2.0.3+incompatible
8+
github.com/docker/docker-credential-helpers v0.6.4
9+
github.com/godror/godror v0.27.1
10+
github.com/gorilla/mux v1.8.0
1211
github.com/ibmdb/go_ibm_db v0.4.1
13-
github.com/jmoiron/sqlx v1.2.0
14-
github.com/kr/pretty v0.1.0 // indirect
15-
github.com/lib/pq v1.3.0
16-
github.com/mattn/go-isatty v0.0.13
17-
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
12+
github.com/jmoiron/sqlx v1.3.4
13+
github.com/lib/pq v1.10.3
14+
github.com/mattn/go-isatty v0.0.14
1815
github.com/mitchellh/go-homedir v1.1.0
19-
github.com/rs/zerolog v1.21.0
20-
github.com/spf13/cobra v0.0.5
21-
github.com/stretchr/objx v0.1.1 // indirect
22-
github.com/stretchr/testify v1.5.1
23-
github.com/xo/dburl v0.0.0-20200124232849-e9ec94f52bc3
24-
golang.org/x/term v0.0.0-20210503060354-a79de5458b56
25-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
26-
gopkg.in/yaml.v2 v2.2.4 // indirect
27-
gopkg.in/yaml.v3 v3.0.0-20191010095647-fc94e3f71652
16+
github.com/rs/zerolog v1.25.0
17+
github.com/spf13/cobra v1.2.1
18+
github.com/stretchr/testify v1.7.0
19+
github.com/xo/dburl v0.9.0
20+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
21+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
22+
)
23+
24+
require (
25+
github.com/davecgh/go-spew v1.1.1 // indirect
26+
github.com/go-logfmt/logfmt v0.5.1 // indirect
27+
github.com/go-sql-driver/mysql v1.6.0 // indirect
28+
github.com/inconshreveable/mousetrap v1.0.0 // indirect
29+
github.com/kr/pretty v0.3.0 // indirect
30+
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
31+
github.com/pmezard/go-difflib v1.0.0 // indirect
32+
github.com/spf13/pflag v1.0.5 // indirect
33+
github.com/stretchr/objx v0.3.0 // indirect
34+
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac // indirect
35+
google.golang.org/protobuf v1.27.1 // indirect
36+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
2837
)

go.sum

Lines changed: 573 additions & 61 deletions
Large diffs are not rendered by default.

internal/app/localstorage/localstorage.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package localstorage
1919

2020
import (
21+
"bytes"
2122
"fmt"
2223
"io/ioutil"
2324
"os"
@@ -193,7 +194,11 @@ func readFile() (*YAMLCredentialsStore, error) {
193194
}
194195

195196
func writeFile(list *YAMLCredentialsStore) error {
196-
out, err := yaml.Marshal(list)
197+
out := &bytes.Buffer{}
198+
enc := yaml.NewEncoder(out)
199+
enc.SetIndent(2)
200+
201+
err := enc.Encode(list)
197202
if err != nil {
198203
return err
199204
}
@@ -215,7 +220,7 @@ func writeFile(list *YAMLCredentialsStore) error {
215220

216221
storeFile := path.Join(storeDir, FileName)
217222

218-
err = ioutil.WriteFile(storeFile, out, 0600)
223+
err = ioutil.WriteFile(storeFile, out.Bytes(), 0600)
219224
if err != nil {
220225
return err
221226
}

internal/app/urlbuilder/urlbuilder.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ func GenOracleRaw(u *dburl.URL) (string, error) {
6060
func init() {
6161
oracleScheme := dburl.Scheme{
6262
Driver: "godror-raw",
63-
Override: "godror",
6463
Generator: GenOracleRaw,
64+
Transport: dburl.TransportAny,
6565
Opaque: false,
6666
Aliases: []string{"oracle-raw"},
67-
Proto: dburl.ProtoAny,
67+
Override: "godror",
6868
}
6969
dburl.Register(oracleScheme)
7070

@@ -76,17 +76,17 @@ func init() {
7676
result := fmt.Sprintf("HOSTNAME=%s;DATABASE=%s;PORT=%s;UID=%s;PWD=%s", u.Hostname(), database, u.Port(), u.User.Username(), password)
7777
return result, nil
7878
},
79-
Proto: dburl.ProtoAny,
80-
Opaque: false,
81-
Aliases: []string{"go_ibm_db"},
82-
Override: "go_ibm_db",
79+
Transport: dburl.TransportAny,
80+
Opaque: false,
81+
Aliases: []string{"go_ibm_db"},
82+
Override: "go_ibm_db",
8383
}
8484
dburl.Register(db2Scheme)
8585

8686
httpScheme := dburl.Scheme{
8787
Driver: "http",
8888
Generator: dburl.GenFromURL("http://localhost:8080"),
89-
Proto: dburl.ProtoAny,
89+
Transport: dburl.TransportAny,
9090
Opaque: false,
9191
Aliases: []string{"https"},
9292
Override: "",

internal/app/urlbuilder/urlbuilder_test.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package urlbuilder
33
import (
44
"testing"
55

6+
"github.com/stretchr/testify/assert"
67
"github.com/xo/dburl"
78
)
89

@@ -12,11 +13,6 @@ func TestBuildOracleURL(t *testing.T) {
1213
args string
1314
want string
1415
}{
15-
{
16-
"oracle",
17-
"oracle://user:pwd@dbhost:1521/orclpdb1/?connect_timeout=2",
18-
"user/pwd@//dbhost:1521/orclpdb1",
19-
},
2016
{
2117
"oracle-raw",
2218
"oracle-raw://user:pwd@dbhost:1521/orclpdb1/?connect_timeout=2",
@@ -27,11 +23,6 @@ func TestBuildOracleURL(t *testing.T) {
2723
"oracle-raw://user:pwd@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orclpdb1)))",
2824
`connectString="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orclpdb1)))" user="user" password="pwd"`,
2925
},
30-
{
31-
"oracle",
32-
"oracle://user:pwd@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orclpdb1)))",
33-
"user/pwd@//(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orclpdb1)))",
34-
},
3526
}
3627
for _, tt := range tests {
3728
t.Run(tt.name, func(t *testing.T) {
@@ -40,9 +31,7 @@ func TestBuildOracleURL(t *testing.T) {
4031
t.Errorf("parse return error : %v", err)
4132
}
4233

43-
if url.DSN != tt.want {
44-
t.Errorf("DSN should be %s not %v", tt.want, url.DSN)
45-
}
34+
assert.Equal(t, tt.want, url.DSN)
4635
})
4736
}
4837
}

internal/infra/dataconnector/yaml.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package dataconnector
1919

2020
import (
21+
"bytes"
2122
"io/ioutil"
2223
"os"
2324

@@ -163,12 +164,16 @@ func readFile() (*YAMLStructure, *dataconnector.Error) {
163164
}
164165

165166
func writeFile(list *YAMLStructure) *dataconnector.Error {
166-
out, err := yaml.Marshal(list)
167+
out := &bytes.Buffer{}
168+
enc := yaml.NewEncoder(out)
169+
enc.SetIndent(2)
170+
171+
err := enc.Encode(list)
167172
if err != nil {
168173
return &dataconnector.Error{Description: err.Error()}
169174
}
170175

171-
err = ioutil.WriteFile("dataconnector.yaml", out, 0600)
176+
err = ioutil.WriteFile("dataconnector.yaml", out.Bytes(), 0600)
172177
if err != nil {
173178
return &dataconnector.Error{Description: err.Error()}
174179
}

internal/infra/id/yaml_storage.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package id
1919

2020
import (
21+
"bytes"
2122
"io/ioutil"
2223

2324
"github.com/cgi-fr/lino/pkg/id"
@@ -112,12 +113,16 @@ func (s *YAMLStorage) Read() (id.IngressDescriptor, *id.Error) {
112113
}
113114

114115
func writeFile(structure *YAMLStructure, filename string) *id.Error {
115-
out, err := yaml.Marshal(structure)
116+
out := &bytes.Buffer{}
117+
enc := yaml.NewEncoder(out)
118+
enc.SetIndent(2)
119+
120+
err := enc.Encode(structure)
116121
if err != nil {
117122
return &id.Error{Description: err.Error()}
118123
}
119124

120-
err = ioutil.WriteFile(filename, out, 0600)
125+
err = ioutil.WriteFile(filename, out.Bytes(), 0600)
121126
if err != nil {
122127
return &id.Error{Description: err.Error()}
123128
}

internal/infra/relation/storage_yaml.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package relation
1919

2020
import (
21+
"bytes"
2122
"io/ioutil"
2223

2324
"github.com/cgi-fr/lino/pkg/relation"
@@ -132,12 +133,16 @@ func readFile() (*YAMLStructure, *relation.Error) {
132133
}
133134

134135
func writeFile(list *YAMLStructure) *relation.Error {
135-
out, err := yaml.Marshal(list)
136+
out := &bytes.Buffer{}
137+
enc := yaml.NewEncoder(out)
138+
enc.SetIndent(2)
139+
140+
err := enc.Encode(list)
136141
if err != nil {
137142
return &relation.Error{Description: err.Error()}
138143
}
139144

140-
err = ioutil.WriteFile("relations.yaml", out, 0600)
145+
err = ioutil.WriteFile("relations.yaml", out.Bytes(), 0600)
141146
if err != nil {
142147
return &relation.Error{Description: err.Error()}
143148
}

internal/infra/table/storage_yaml.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package table
1919

2020
import (
21+
"bytes"
2122
"io/ioutil"
2223

2324
"github.com/cgi-fr/lino/pkg/table"
@@ -126,12 +127,16 @@ func readFile() (*YAMLStructure, *table.Error) {
126127
}
127128

128129
func writeFile(list *YAMLStructure) *table.Error {
129-
out, err := yaml.Marshal(list)
130+
out := &bytes.Buffer{}
131+
enc := yaml.NewEncoder(out)
132+
enc.SetIndent(2)
133+
134+
err := enc.Encode(list)
130135
if err != nil {
131136
return &table.Error{Description: err.Error()}
132137
}
133138

134-
err = ioutil.WriteFile("tables.yaml", out, 0600)
139+
err = ioutil.WriteFile("tables.yaml", out.Bytes(), 0600)
135140
if err != nil {
136141
return &table.Error{Description: err.Error()}
137142
}

0 commit comments

Comments
 (0)