*: organize imports and add gci linter

Organize imports using gci and add related linter to check them.
This commit is contained in:
Simone Gotti 2023-03-28 10:10:38 +02:00
parent a2036a7b0a
commit 488ab6b008
174 changed files with 486 additions and 466 deletions

View File

@ -1,11 +1,19 @@
linters:
enable:
- gci
- stylecheck
- errorlint
- wrapcheck
- paralleltest
linters-settings:
gci:
sections:
- standard
- default
- prefix(agola.io/agola)
- blank
- dot
wrapcheck:
# An array of strings that specify substrings of signatures to ignore.
# If this set, it will override the default set of ignored signatures.

View File

@ -19,12 +19,12 @@ import (
"os"
"time"
"agola.io/agola/cmd"
"agola.io/agola/internal/errors"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/cmd"
"agola.io/agola/internal/errors"
)
var token string

View File

@ -17,8 +17,9 @@ package cmd
import (
"os"
"agola.io/agola/internal/errors"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
)
var cmdCompletion = &cobra.Command{

View File

@ -23,16 +23,16 @@ import (
"strings"
"unicode"
"github.com/ghodss/yaml"
"github.com/gofrs/uuid"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gitsave "agola.io/agola/internal/git-save"
"agola.io/agola/internal/util"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/ghodss/yaml"
"github.com/gofrs/uuid"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdDirectRunStart = &cobra.Command{

View File

@ -20,11 +20,11 @@ import (
"io"
"os"
"agola.io/agola/internal/errors"
gatewayclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gatewayclient "agola.io/agola/services/gateway/client"
)
var cmdExport = &cobra.Command{

View File

@ -18,11 +18,11 @@ import (
"context"
"os"
"agola.io/agola/internal/errors"
gatewayclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gatewayclient "agola.io/agola/services/gateway/client"
)
var cmdImport = &cobra.Command{

View File

@ -17,12 +17,12 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdLogDelete = &cobra.Command{

View File

@ -20,12 +20,12 @@ import (
"net/http"
"os"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdLogGet = &cobra.Command{

View File

@ -17,10 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gatewayclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gatewayclient "agola.io/agola/services/gateway/client"
)
var cmdMaintenanceDisable = &cobra.Command{

View File

@ -17,10 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gatewayclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gatewayclient "agola.io/agola/services/gateway/client"
)
var cmdMaintenanceEnable = &cobra.Command{

View File

@ -18,11 +18,11 @@ import (
"context"
"os"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/migration"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/migration"
)
var cmdMigrate = &cobra.Command{

View File

@ -17,12 +17,12 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdOrgCreate = &cobra.Command{

View File

@ -17,11 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdOrgDelete = &cobra.Command{

View File

@ -17,12 +17,12 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdOrgMemberAdd = &cobra.Command{

View File

@ -19,11 +19,11 @@ import (
"encoding/json"
"os"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdOrgMemberList = &cobra.Command{

View File

@ -17,11 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdOrgMemberRemove = &cobra.Command{

View File

@ -17,12 +17,12 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdProjectCreate = &cobra.Command{

View File

@ -17,11 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdProjectDelete = &cobra.Command{

View File

@ -17,12 +17,12 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdProjectGroupCreate = &cobra.Command{

View File

@ -17,11 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdProjectGroupDelete = &cobra.Command{

View File

@ -17,12 +17,12 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdProjectGroupUpdate = &cobra.Command{

View File

@ -18,12 +18,12 @@ import (
"context"
"fmt"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdProjectList = &cobra.Command{

View File

@ -17,11 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdProjectReconfig = &cobra.Command{

View File

@ -19,13 +19,13 @@ import (
"io"
"os"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/ghodss/yaml"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdProjectSecretCreate = &cobra.Command{

View File

@ -17,11 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdProjectSecretDelete = &cobra.Command{

View File

@ -19,12 +19,12 @@ import (
"encoding/json"
"fmt"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdProjectSecretList = &cobra.Command{

View File

@ -19,13 +19,13 @@ import (
"io"
"os"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/ghodss/yaml"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdProjectSecretUpdate = &cobra.Command{

View File

@ -17,12 +17,12 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdProjectUpdate = &cobra.Command{

View File

@ -19,14 +19,14 @@ import (
"io"
"os"
"github.com/ghodss/yaml"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
config "agola.io/agola/internal/config"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/ghodss/yaml"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdProjectVariableCreate = &cobra.Command{

View File

@ -17,11 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdProjectVariableDelete = &cobra.Command{

View File

@ -19,12 +19,12 @@ import (
"encoding/json"
"fmt"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdProjectVariableList = &cobra.Command{

View File

@ -19,13 +19,13 @@ import (
"io"
"os"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/ghodss/yaml"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdProjectVariableUpdate = &cobra.Command{

View File

@ -17,14 +17,14 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/gitsources/github"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"agola.io/agola/util"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdRemoteSourceCreate = &cobra.Command{

View File

@ -18,12 +18,12 @@ import (
"context"
"fmt"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdRemoteSourceList = &cobra.Command{

View File

@ -17,12 +17,12 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdRemoteSourceUpdate = &cobra.Command{

View File

@ -17,12 +17,12 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdRunCreate = &cobra.Command{

View File

@ -19,12 +19,12 @@ import (
"fmt"
"sort"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdRunList = &cobra.Command{

View File

@ -18,6 +18,9 @@ import (
"context"
"fmt"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/cmd"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/config"
@ -29,9 +32,6 @@ import (
"agola.io/agola/internal/services/runservice"
"agola.io/agola/internal/services/scheduler"
"agola.io/agola/internal/util"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var (

View File

@ -17,12 +17,12 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdUserCreate = &cobra.Command{

View File

@ -17,11 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdUserDelete = &cobra.Command{

View File

@ -17,12 +17,12 @@ package cmd
import (
"context"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdUserLACreate = &cobra.Command{

View File

@ -17,11 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdUserLADelete = &cobra.Command{

View File

@ -18,12 +18,12 @@ import (
"context"
"fmt"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdUserList = &cobra.Command{

View File

@ -18,12 +18,12 @@ import (
"context"
"fmt"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwapitypes "agola.io/agola/services/gateway/api/types"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
var cmdUserTokenCreate = &cobra.Command{

View File

@ -17,11 +17,11 @@ package cmd
import (
"context"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdUserTokenDelete = &cobra.Command{

View File

@ -18,11 +18,11 @@ import (
"context"
"fmt"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
gwclient "agola.io/agola/services/gateway/client"
)
var cmdVersion = &cobra.Command{

View File

@ -20,11 +20,11 @@ import (
"log"
"os"
"github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
"agola.io/agola/internal/toolbox/archive"
"agola.io/agola/internal/util"
"github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
)
var cmdArchive = &cobra.Command{

View File

@ -20,8 +20,9 @@ import (
"log"
"os"
"agola.io/agola/internal/errors"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
)
var cmdCreateFile = &cobra.Command{

View File

@ -26,9 +26,9 @@ import (
"text/template"
"time"
"agola.io/agola/internal/errors"
"github.com/spf13/cobra"
"agola.io/agola/internal/errors"
)
var cmdTemplate = &cobra.Command{

View File

@ -18,9 +18,9 @@ import (
"log"
"os"
"agola.io/agola/cmd"
"github.com/spf13/cobra"
"agola.io/agola/cmd"
)
var CmdToolbox = &cobra.Command{

View File

@ -20,10 +20,10 @@ import (
"log"
"os"
"agola.io/agola/internal/toolbox/unarchive"
"github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
"agola.io/agola/internal/toolbox/unarchive"
)
var cmdUnarchive = &cobra.Command{

View File

@ -20,13 +20,13 @@ import (
"regexp"
"strings"
"github.com/ghodss/yaml"
"k8s.io/apimachinery/pkg/api/resource"
"agola.io/agola/internal/errors"
itypes "agola.io/agola/internal/services/types"
"agola.io/agola/internal/util"
"agola.io/agola/services/types"
"github.com/ghodss/yaml"
"k8s.io/apimachinery/pkg/api/resource"
)
const (

View File

@ -17,12 +17,12 @@ package config
import (
"testing"
"github.com/google/go-cmp/cmp"
"k8s.io/apimachinery/pkg/api/resource"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/util"
"agola.io/agola/services/types"
"github.com/google/go-cmp/cmp"
"k8s.io/apimachinery/pkg/api/resource"
)
func TestParseConfig(t *testing.T) {

View File

@ -17,8 +17,9 @@ package config
import (
"encoding/json"
"agola.io/agola/internal/errors"
"github.com/google/go-jsonnet"
"agola.io/agola/internal/errors"
)
func execJsonnet(configData []byte, configContext *ConfigContext) ([]byte, error) {

View File

@ -19,8 +19,9 @@ import (
"encoding/json"
"fmt"
"agola.io/agola/internal/errors"
"go.starlark.net/starlark"
"agola.io/agola/internal/errors"
)
func starlarkArgs(cc *ConfigContext) (starlark.Tuple, error) {

View File

@ -19,9 +19,10 @@ import (
"math"
"testing"
"agola.io/agola/internal/errors"
"github.com/google/go-cmp/cmp"
"go.starlark.net/starlark"
"agola.io/agola/internal/errors"
)
func TestStarlarkJSON(t *testing.T) {

View File

@ -6,11 +6,11 @@ import (
"fmt"
"io"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
sq "github.com/Masterminds/squirrel"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
)
func Export(ctx context.Context, log zerolog.Logger, d DB, w io.Writer) error {

View File

@ -7,10 +7,10 @@ import (
"fmt"
"io"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
"github.com/rs/zerolog"
)
func Import(ctx context.Context, log zerolog.Logger, d DB, r io.Reader) error {

View File

@ -4,11 +4,11 @@ import (
"context"
"fmt"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
sq "github.com/Masterminds/squirrel"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
)
func rebuild(ctx context.Context, log zerolog.Logger, d DB) error {

View File

@ -6,13 +6,13 @@ import (
"fmt"
"time"
sq "github.com/Masterminds/squirrel"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/lock"
"agola.io/agola/internal/sql"
stypes "agola.io/agola/services/types"
sq "github.com/Masterminds/squirrel"
"github.com/rs/zerolog"
)
const (

View File

@ -55,16 +55,16 @@ func (f Frame) name() string {
// Format formats the frame according to the fmt.Formatter interface.
//
// %s source file
// %d source line
// %n function name
// %v equivalent to %s:%d
// %s source file
// %d source line
// %n function name
// %v equivalent to %s:%d
//
// Format accepts flags that alter the printing of some verbs, as follows:
//
// %+s function name and path of source file relative to the compile time
// GOPATH separated by \n\t (<funcname>\n\t<path>)
// %+v equivalent to %+s:%d
// %+s function name and path of source file relative to the compile time
// GOPATH separated by \n\t (<funcname>\n\t<path>)
// %+v equivalent to %+s:%d
func (f Frame) Format(s fmt.State, verb rune) {
switch verb {
case 's':
@ -102,12 +102,12 @@ type StackTrace []Frame
// Format formats the stack of Frames according to the fmt.Formatter interface.
//
// %s lists source files for each Frame in the stack
// %v lists the source file and line number for each Frame in the stack
// %s lists source files for each Frame in the stack
// %v lists the source file and line number for each Frame in the stack
//
// Format accepts flags that alter the printing of some verbs, as follows:
//
// %+v Prints filename, function, and line number for each Frame in the stack.
// %+v Prints filename, function, and line number for each Frame in the stack.
func (st StackTrace) Format(s fmt.State, verb rune) {
switch verb {
case 'v':

View File

@ -7,7 +7,7 @@ import (
)
// copied from zerolog console writer since they aren't exported
//nolint
// nolint
const (
colorBlack = iota + 30
colorRed

View File

@ -47,11 +47,11 @@ import (
stdsql "database/sql"
"encoding/json"
sq "github.com/Masterminds/squirrel"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
"{{ .TypesPath }}"
sq "github.com/Masterminds/squirrel"
)
{{- range $index, $oi := .ObjectInfos }}

View File

@ -47,12 +47,12 @@ import (
"encoding/json"
"time"
sq "github.com/Masterminds/squirrel"
idb "agola.io/agola/internal/db"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
"{{ .TypesPath }}"
sq "github.com/Masterminds/squirrel"
)
{{- range $index, $oi := .ObjectInfos }}

View File

@ -24,10 +24,10 @@ import (
"regexp"
"strings"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/util"
"github.com/rs/zerolog"
)
var (

View File

@ -20,11 +20,11 @@ import (
"os"
"path/filepath"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/util"
"github.com/gofrs/uuid"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/util"
)
const (

View File

@ -26,11 +26,11 @@ import (
"strings"
"time"
"agola.io/agola/internal/errors"
gitsource "agola.io/agola/internal/gitsources"
"code.gitea.io/sdk/gitea"
"golang.org/x/oauth2"
"agola.io/agola/internal/errors"
gitsource "agola.io/agola/internal/gitsources"
)
var (

View File

@ -28,11 +28,11 @@ import (
"strings"
"time"
"agola.io/agola/internal/errors"
gitsource "agola.io/agola/internal/gitsources"
"github.com/google/go-github/v50/github"
"golang.org/x/oauth2"
"agola.io/agola/internal/errors"
gitsource "agola.io/agola/internal/gitsources"
)
var (

View File

@ -21,10 +21,10 @@ import (
"strconv"
"strings"
"github.com/google/go-github/v50/github"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/types"
"github.com/google/go-github/v50/github"
)
const (

View File

@ -26,11 +26,11 @@ import (
"strings"
"time"
"agola.io/agola/internal/errors"
gitsource "agola.io/agola/internal/gitsources"
gitlab "github.com/xanzy/go-gitlab"
"golang.org/x/oauth2"
"agola.io/agola/internal/errors"
gitsource "agola.io/agola/internal/gitsources"
)
var (

View File

@ -17,10 +17,10 @@ package gitsource
import (
"net/http"
"golang.org/x/oauth2"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/types"
"golang.org/x/oauth2"
)
type CommitStatus string

View File

@ -4,8 +4,9 @@ import (
"context"
"sync"
"agola.io/agola/internal/errors"
"golang.org/x/sync/semaphore"
"agola.io/agola/internal/errors"
)
type LocalLocks struct {

View File

@ -8,6 +8,9 @@ import (
"os"
"path/filepath"
"github.com/mitchellh/mapstructure"
"github.com/rs/zerolog/log"
idb "agola.io/agola/internal/db"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/lock"
@ -15,9 +18,6 @@ import (
ndb "agola.io/agola/internal/services/configstore/db"
"agola.io/agola/internal/sql"
"agola.io/agola/services/configstore/types"
"github.com/mitchellh/mapstructure"
"github.com/rs/zerolog/log"
)
func MigrateConfigStore(ctx context.Context, r io.Reader, w io.Writer) error {

View File

@ -8,6 +8,9 @@ import (
"os"
"path/filepath"
"github.com/mitchellh/mapstructure"
"github.com/rs/zerolog/log"
idb "agola.io/agola/internal/db"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/lock"
@ -15,9 +18,6 @@ import (
ndb "agola.io/agola/internal/services/runservice/db"
"agola.io/agola/internal/sql"
"agola.io/agola/services/runservice/types"
"github.com/mitchellh/mapstructure"
"github.com/rs/zerolog/log"
)
func MigrateRunService(ctx context.Context, r io.Reader, w io.Writer) error {

View File

@ -20,11 +20,11 @@ import (
"fmt"
"time"
"github.com/mitchellh/copystructure"
"agola.io/agola/internal/errors"
"agola.io/agola/services/types"
"agola.io/agola/util"
"github.com/mitchellh/copystructure"
)
const (

View File

@ -20,8 +20,9 @@ import (
"os"
"strings"
"agola.io/agola/internal/errors"
minio "github.com/minio/minio-go/v6"
"agola.io/agola/internal/errors"
)
type S3Storage struct {

View File

@ -20,14 +20,14 @@ import (
"testing"
"time"
"github.com/google/go-cmp/cmp"
"k8s.io/apimachinery/pkg/api/resource"
"agola.io/agola/internal/config"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/util"
rstypes "agola.io/agola/services/runservice/types"
"agola.io/agola/services/types"
"k8s.io/apimachinery/pkg/api/resource"
"github.com/google/go-cmp/cmp"
)
var uuid = &util.TestUUIDGenerator{}

View File

@ -19,8 +19,9 @@ import (
"encoding/json"
"time"
"agola.io/agola/internal/errors"
"github.com/golang-jwt/jwt/v4"
"agola.io/agola/internal/errors"
)
type TokenSigningData struct {

View File

@ -17,10 +17,10 @@ package common
import (
"testing"
"github.com/google/go-cmp/cmp"
csapitypes "agola.io/agola/services/configstore/api/types"
cstypes "agola.io/agola/services/configstore/types"
"github.com/google/go-cmp/cmp"
)
func TestFilterOverriddenVariables(t *testing.T) {

View File

@ -18,11 +18,11 @@ import (
"os"
"time"
yaml "gopkg.in/yaml.v2"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
"agola.io/agola/internal/util"
yaml "gopkg.in/yaml.v2"
)
const (

View File

@ -15,14 +15,14 @@
package action
import (
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/lock"
"agola.io/agola/internal/services/configstore/db"
"agola.io/agola/internal/sql"
"agola.io/agola/internal/util"
"agola.io/agola/services/configstore/types"
"github.com/rs/zerolog"
)
type ActionHandler struct {

View File

@ -21,12 +21,12 @@ import (
"io"
"time"
sq "github.com/Masterminds/squirrel"
idb "agola.io/agola/internal/db"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
"agola.io/agola/internal/util"
sq "github.com/Masterminds/squirrel"
)
var sb = sq.StatementBuilder.PlaceholderFormat(sq.Dollar)

View File

@ -18,13 +18,12 @@ import (
"context"
"path"
"github.com/gofrs/uuid"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
"agola.io/agola/internal/util"
"agola.io/agola/services/configstore/types"
"github.com/gofrs/uuid"
)
func (h *ActionHandler) ValidateProjectReq(ctx context.Context, req *CreateUpdateProjectRequest) error {

View File

@ -21,7 +21,6 @@ import (
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
"agola.io/agola/internal/util"
"agola.io/agola/services/configstore/types"
)

View File

@ -19,7 +19,6 @@ import (
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
"agola.io/agola/internal/util"
"agola.io/agola/services/configstore/types"
)

View File

@ -18,13 +18,13 @@ import (
"context"
"time"
"github.com/gofrs/uuid"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/configstore/db"
"agola.io/agola/internal/sql"
"agola.io/agola/internal/util"
"agola.io/agola/services/configstore/types"
"github.com/gofrs/uuid"
)
type CreateUserRequest struct {

View File

@ -19,7 +19,6 @@ import (
"agola.io/agola/internal/errors"
"agola.io/agola/internal/sql"
"agola.io/agola/internal/util"
"agola.io/agola/services/configstore/types"
)

View File

@ -18,11 +18,11 @@ import (
"net/http"
"net/url"
"github.com/gorilla/mux"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/util"
"agola.io/agola/services/configstore/types"
"github.com/gorilla/mux"
)
type ErrorResponse struct {

View File

@ -17,11 +17,10 @@ package api
import (
"net/http"
"agola.io/agola/internal/services/configstore/action"
"agola.io/agola/internal/util"
"github.com/rs/zerolog"
"agola.io/agola/internal/services/configstore/action"
"agola.io/agola/internal/util"
csapitypes "agola.io/agola/services/configstore/api/types"
)

View File

@ -19,6 +19,9 @@ import (
"net/http"
"strconv"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/configstore/action"
"agola.io/agola/internal/services/configstore/db"
@ -26,9 +29,6 @@ import (
"agola.io/agola/internal/util"
csapitypes "agola.io/agola/services/configstore/api/types"
"agola.io/agola/services/configstore/types"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
)
type OrgHandler struct {

View File

@ -21,6 +21,9 @@ import (
"net/url"
"path"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/configstore/action"
"agola.io/agola/internal/services/configstore/db"
@ -28,9 +31,6 @@ import (
"agola.io/agola/internal/util"
csapitypes "agola.io/agola/services/configstore/api/types"
"agola.io/agola/services/configstore/types"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
)
func projectResponse(ctx context.Context, d *db.DB, project *types.Project) (*csapitypes.Project, error) {

View File

@ -21,6 +21,9 @@ import (
"net/url"
"path"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/configstore/action"
"agola.io/agola/internal/services/configstore/db"
@ -28,9 +31,6 @@ import (
"agola.io/agola/internal/util"
csapitypes "agola.io/agola/services/configstore/api/types"
"agola.io/agola/services/configstore/types"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
)
func projectGroupResponse(ctx context.Context, d *db.DB, projectGroup *types.ProjectGroup) (*csapitypes.ProjectGroup, error) {

View File

@ -19,6 +19,9 @@ import (
"net/http"
"strconv"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/configstore/action"
"agola.io/agola/internal/services/configstore/db"
@ -26,9 +29,6 @@ import (
"agola.io/agola/internal/util"
csapitypes "agola.io/agola/services/configstore/api/types"
"agola.io/agola/services/configstore/types"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
)
type RemoteSourceHandler struct {

View File

@ -18,6 +18,9 @@ import (
"encoding/json"
"net/http"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/configstore/action"
"agola.io/agola/internal/services/configstore/db"
@ -25,9 +28,6 @@ import (
"agola.io/agola/internal/util"
csapitypes "agola.io/agola/services/configstore/api/types"
"agola.io/agola/services/configstore/types"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
)
type SecretHandler struct {

View File

@ -19,6 +19,9 @@ import (
"net/http"
"strconv"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
action "agola.io/agola/internal/services/configstore/action"
"agola.io/agola/internal/services/configstore/db"
@ -26,9 +29,6 @@ import (
"agola.io/agola/internal/util"
csapitypes "agola.io/agola/services/configstore/api/types"
"agola.io/agola/services/configstore/types"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
)
type UserHandler struct {

View File

@ -18,6 +18,9 @@ import (
"encoding/json"
"net/http"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/configstore/action"
"agola.io/agola/internal/services/configstore/db"
@ -25,9 +28,6 @@ import (
"agola.io/agola/internal/util"
csapitypes "agola.io/agola/services/configstore/api/types"
"agola.io/agola/services/configstore/types"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
)
type VariablesHandler struct {

View File

@ -18,8 +18,9 @@ import (
"net/url"
"strings"
"agola.io/agola/internal/errors"
"github.com/gofrs/uuid"
"agola.io/agola/internal/errors"
)
type RefType int

View File

@ -21,6 +21,10 @@ import (
"sync"
"time"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
scommon "agola.io/agola/internal/common"
idb "agola.io/agola/internal/db"
"agola.io/agola/internal/errors"
@ -32,10 +36,6 @@ import (
"agola.io/agola/internal/services/configstore/db"
"agola.io/agola/internal/sql"
"agola.io/agola/internal/util"
"github.com/gorilla/mux"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
func (s *Configstore) maintenanceModeWatcherLoop(ctx context.Context, runCtxCancel context.CancelFunc, maintenanceModeEnabled bool) {

View File

@ -26,6 +26,10 @@ import (
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/rs/zerolog"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/config"
"agola.io/agola/internal/services/configstore/action"
@ -34,10 +38,6 @@ import (
"agola.io/agola/internal/util"
"agola.io/agola/services/configstore/types"
stypes "agola.io/agola/services/types"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/rs/zerolog"
)
func setupConfigstore(ctx context.Context, t *testing.T, log zerolog.Logger, dir string) *Configstore {

View File

@ -7,6 +7,9 @@ import (
"path"
"strings"
sq "github.com/Masterminds/squirrel"
"github.com/rs/zerolog"
idb "agola.io/agola/internal/db"
"agola.io/agola/internal/errors"
"agola.io/agola/internal/services/configstore/common"
@ -14,9 +17,6 @@ import (
"agola.io/agola/internal/sql"
"agola.io/agola/services/configstore/types"
stypes "agola.io/agola/services/types"
sq "github.com/Masterminds/squirrel"
"github.com/rs/zerolog"
)
//go:generate ../../../../tools/bin/generators -component configstore

Some files were not shown because too many files have changed in this diff Show More