fix(global): Multiple small fixes and upgrade of go + goswagger
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Matthieu 'JP' DERASSE 2022-11-21 17:22:17 +00:00
parent b1f168286f
commit 5f4e7e5be6
Signed by: mderasse
GPG Key ID: 55141C777B16A705
22 changed files with 155 additions and 567 deletions

View File

@ -9,7 +9,7 @@ platform:
steps:
- name: environment
image: golang:1.18
image: golang:1.19
commands:
- go version
- go env
@ -18,9 +18,9 @@ steps:
path: /go
- name: tools
image: golang:1.18
image: golang:1.19
commands:
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.47.3
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
- go install github.com/tebeka/go2xunit@latest
- go install github.com/t-yuki/gocover-cobertura@latest
volumes:
@ -30,7 +30,7 @@ steps:
- environment
- name: tidy
image: golang:1.18
image: golang:1.19
commands:
- go mod tidy
- git diff --exit-code -- go.mod go.sum
@ -41,7 +41,7 @@ steps:
- tools
- name: lint
image: golang:1.18
image: golang:1.19
commands:
- echo 'Running linting'
- golangci-lint run
@ -52,7 +52,7 @@ steps:
- tools
- name: test
image: golang:1.18
image: golang:1.19
commands:
- go test -cover -v ./...
volumes:

View File

@ -61,7 +61,6 @@ linters:
- bidichk
- bodyclose # checks whether HTTP response body is closed successfully
- containedctx
- deadcode # finds unused code
- decorder
- depguard
- dupl # tool for code clone detection
@ -81,7 +80,6 @@ linters:
- gosec # inspects source code for security problems
- gosimple # linter for Go source code that specializes in simplifying a code
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
- ifshort
- importas # enforces consistent import aliases
- ineffassign # detects when assignments to existing variables are not used
- makezero
@ -94,16 +92,14 @@ linters:
- nonamedreturns
- prealloc # finds slice declarations that could potentially be preallocated
- revive
- sqlclosecheck
# Disable because of generic - sqlclosecheck
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
- structcheck # finds unused struct fields
- stylecheck # a replacement for golint
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
- unconvert # Remove unnecessary type conversions
- unparam # reports unused function parameters
- unused # checks Go code for unused constants, variables, functions and types
- varcheck # Finds unused global variables and constants
- wastedassign # wastedassign finds wasted assignment statements.
# Disable because of generic - wastedassign # wastedassign finds wasted assignment statements.
# all available settings of specific linters
linters-settings:

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd
@ -118,7 +117,7 @@ func runInitAction(cmd *cobra.Command, args []string) {
// ask project directory
log.Info("Name of the project directory:")
projectDirectory := input.Alphanumerical(true)
projectDirectory := strings.ToLower(input.Alphanumerical(true))
// ask project name
log.Info("Name of the project:")
@ -177,7 +176,7 @@ func runInitAction(cmd *cobra.Command, args []string) {
}
// Execute git init.
log.Info("Initializing Git")
log.Info("Initializing Git with main branch")
gitinit := exec.Command("git", "init")
_, err = gitinit.Output()
@ -186,6 +185,13 @@ func runInitAction(cmd *cobra.Command, args []string) {
return
}
gitcheckout := exec.Command("git", "checkout", "-b", "main")
_, err = gitcheckout.Output()
if err != nil {
log.Errorf("Fail to git checkout -b main. The following error happen: %s", err.Error())
return
}
log.Info("Creating gouick configuration file")
err = helpers.WriteConfig(projectDirPath, config)
if err != nil {

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

66
go.mod
View File

@ -1,58 +1,68 @@
module git.home.m-and-m.ovh/mderasse/gouick
go 1.17
go 1.19
require (
github.com/blang/semver v3.5.1+incompatible
github.com/go-swagger/go-swagger v0.29.0
github.com/go-swagger/go-swagger v0.30.3
github.com/jessevdk/go-flags v1.5.0
github.com/juju/errors v1.0.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.5.0
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.6.1
gopkg.in/yaml.v3 v3.0.1
)
require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-openapi/analysis v0.21.4 // indirect
github.com/go-openapi/errors v0.20.2 // indirect
github.com/go-openapi/errors v0.20.3 // indirect
github.com/go-openapi/inflect v0.19.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/loads v0.21.2 // indirect
github.com/go-openapi/runtime v0.21.1 // indirect
github.com/go-openapi/spec v0.20.6 // indirect
github.com/go-openapi/runtime v0.24.2 // indirect
github.com/go-openapi/spec v0.20.7 // indirect
github.com/go-openapi/strfmt v0.21.3 // indirect
github.com/go-openapi/swag v0.21.1 // indirect
github.com/go-openapi/validate v0.20.3 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/validate v0.22.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/spf13/afero v1.8.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.10.1 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/spf13/viper v1.14.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/toqueteos/webbrowser v1.2.0 // indirect
go.mongodb.org/mongo-driver v1.10.0 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.8 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/ini.v1 v1.66.3 // indirect
go.mongodb.org/mongo-driver v1.11.0 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/tools v0.3.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

598
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@ import (
)
// minimumGolangVersion is the minimum minor required for the app to work.
const minimumGolangVersion = "1.18.4"
const minimumGolangVersion = "1.19.3"
// installation directory for fresh install.
// will be prefixed by $HOME.
@ -200,9 +200,9 @@ func (g Golang) DescribePostInstall(path string) string {
descriptions := []string{
`For your environment to work correctly, we will add if needed the following environment variable to your .bashrc:
export GOPATH=\"$HOME/go\"`,
export GOPATH="$HOME/go"`,
fmt.Sprintf(" export GOROOT=\"%s\"", path),
` "PATH=\"$GOROOT/bin:$GOPATH/bin:$PATH\"
` PATH="$GOROOT/bin:$GOPATH/bin:$PATH"
You will have to reopen a new terminal to apply the changes or execute the following command:

View File

@ -18,7 +18,7 @@ import (
)
// minimumGolangVersion is the minimum minor required for the app to work.
const minimumSwaggerVersion = "0.29.0"
const minimumSwaggerVersion = "0.30.3"
// installation directory for fresh install.
// will be prefixed by $HOME.
@ -195,7 +195,7 @@ func (s Swagger) Install(path string) error {
func (s Swagger) DescribePostInstall(path string) string {
return `For your environment to work correctly, we will add if needed the following environment variable to your .bashrc:
PATH=\"$HOME/bin:$PATH\"
PATH="$HOME/bin:$PATH"
You will have to reopen a new terminal to apply the changes or execute the following command:

View File

@ -1,6 +1,5 @@
/*
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package main

View File

@ -30,7 +30,7 @@ paths:
#
# SECTION : MONITORING
#
/mon/ping:
/unsecured/mon/ping:
get:
tags:
- Monitoring