mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:11:49 +00:00
bazel: first pass at moving moving logging linting into nogo (#58910)
* First pass at moving moving logging linting into Bazel * fixed negation operators * Update dev/linters/logging/logging.go Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com> * added more exceptions and refactored one or two impls * added nogo lint pragmas to offending files * ran configure * reverted git-combine refactor * ran configure * reverted test as well --------- Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
This commit is contained in:
parent
30cf61e1bf
commit
960d97bf8b
@ -315,6 +315,7 @@ nogo(
|
||||
"//dev/linters/gocheckcompilerdirectives",
|
||||
"//dev/linters/gocritic",
|
||||
"//dev/linters/ineffassign",
|
||||
"//dev/linters/logging",
|
||||
"//dev/linters/unparam",
|
||||
"//dev/linters/tracinglibraries",
|
||||
"//dev/linters/dbconn",
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/inconshreveable/log15" //nolint:go
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log //nolint:go
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
"github.com/sourcegraph/sourcegraph/schema"
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc/github"
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/envvar"
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
@ -16,7 +16,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/regexp"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
sglog "github.com/sourcegraph/log"
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/sourcegraph/conc/pool"
|
||||
"github.com/sourcegraph/go-diff/diff"
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/Masterminds/semver"
|
||||
"github.com/gomodule/redigo/redis"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/hooks"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/processrestart"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/hubspot/hubspotutil"
|
||||
sgactor "github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
|
||||
|
||||
@ -2,9 +2,9 @@ package hubspotutil
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/envvar"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/hubspot"
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/handlerutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/globals"
|
||||
)
|
||||
|
||||
@ -14,7 +14,7 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
|
||||
"go.uber.org/atomic"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap" //nolint:logging // dependencies require direct usage of zap
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/otlpenv"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ package app
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"github.com/dghubble/gologin/v2"
|
||||
"github.com/dghubble/gologin/v2/github"
|
||||
goauth2 "github.com/dghubble/gologin/v2/oauth2"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
gh "github.com/sourcegraph/sourcegraph/internal/extsvc/github"
|
||||
|
||||
@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/dghubble/gologin/v2/github"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
|
||||
@ -11,7 +11,7 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
|
||||
@ -10,7 +10,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ import (
|
||||
"path"
|
||||
|
||||
goauth2 "github.com/dghubble/gologin/v2/oauth2"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/coreos/go-oidc"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/russellhaering/gosaml2/uuid"
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
|
||||
@ -6,13 +6,13 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
stdlog "log"
|
||||
stdlog "log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"net/http"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth/providers"
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
|
||||
sglog "github.com/sourcegraph/log"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/state"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/gomodule/redigo/redis"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/redispool"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package bg
|
||||
|
||||
import (
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/rcache"
|
||||
"github.com/sourcegraph/sourcegraph/internal/redispool"
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // Legacy loghandlers for log15
|
||||
)
|
||||
|
||||
// Trace returns a filter for the given traces that run longer than threshold
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
)
|
||||
|
||||
func TestNotNoisey(t *testing.T) {
|
||||
|
||||
@ -2,7 +2,7 @@ package middleware
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"net/http"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"strconv"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/kr/text"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/env"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/go-langserver/pkg/lsp"
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/errcode"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
@ -2,7 +2,7 @@ package httpapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"net/http"
|
||||
"os"
|
||||
"reflect"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/envvar"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/google/go-github/v55/github"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"io"
|
||||
"io/fs"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"hash/fnv"
|
||||
"io"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"os"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package goreman
|
||||
|
||||
import (
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"os"
|
||||
"os/signal"
|
||||
"sync"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"os"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/server/internal/goreman"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"os"
|
||||
)
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/diskcache"
|
||||
"github.com/sourcegraph/sourcegraph/internal/goroutine"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/symbols/parser"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/basestore"
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/sourcegraph/go-ctags"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
|
||||
|
||||
@ -9,7 +9,8 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
symbolsTypes "github.com/sourcegraph/sourcegraph/cmd/symbols/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"github.com/aws/aws-sdk-go-v2/credentials"
|
||||
"github.com/aws/aws-sdk-go-v2/service/cloudwatch"
|
||||
"github.com/aws/aws-sdk-go-v2/service/cloudwatch/types"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/env"
|
||||
)
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
|
||||
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
|
||||
"cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"google.golang.org/api/option"
|
||||
metricpb "google.golang.org/genproto/googleapis/api/metric"
|
||||
"google.golang.org/genproto/googleapis/api/monitoredres"
|
||||
|
||||
@ -3,7 +3,7 @@ package executorqueue
|
||||
import (
|
||||
"slices"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
executortypes "github.com/sourcegraph/sourcegraph/internal/executor/types"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
|
||||
13
dev/linters/logging/BUILD.bazel
Normal file
13
dev/linters/logging/BUILD.bazel
Normal file
@ -0,0 +1,13 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "logging",
|
||||
srcs = ["logging.go"],
|
||||
importpath = "github.com/sourcegraph/sourcegraph/dev/linters/logging",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//dev/linters/nolint",
|
||||
"@com_github_openpeedeep_depguard_v2//:go_default_library",
|
||||
"@org_golang_x_tools//go/analysis",
|
||||
],
|
||||
)
|
||||
45
dev/linters/logging/logging.go
Normal file
45
dev/linters/logging/logging.go
Normal file
@ -0,0 +1,45 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/OpenPeeDeeP/depguard/v2"
|
||||
"golang.org/x/tools/go/analysis"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/dev/linters/nolint"
|
||||
)
|
||||
|
||||
// This analyzer is modeled after the one in
|
||||
// https://sourcegraph.sourcegraph.com/github.com/sourcegraph/sourcegraph@f6ae87add606c65876b87d378929fcb80c3bb493/-/blob/dev/linters/depguard/depguard.go
|
||||
// These could potentially be combined into one analyzer.
|
||||
var Analyzer *analysis.Analyzer = createAnalyzer()
|
||||
|
||||
const useLogInsteadMessage = `use "github.com/sourcegraph/log" instead`
|
||||
|
||||
// Deny is a map which contains all the deprecated logging packages
|
||||
// The key of the map is the package name that is not allowed - globs can be used as keys.
|
||||
// The value of the key is the reason to give as to why the logger is not allowed.
|
||||
var Deny = map[string]string{
|
||||
"log$": useLogInsteadMessage,
|
||||
"github.com/inconshreveable/log15$": useLogInsteadMessage,
|
||||
"go.uber.org/zap": useLogInsteadMessage,
|
||||
}
|
||||
|
||||
func createAnalyzer() *analysis.Analyzer {
|
||||
settings := &depguard.LinterSettings{
|
||||
"deprecated loggers": &depguard.List{
|
||||
Deny: Deny,
|
||||
Files: []string{
|
||||
// Let everything in dev use whatever they want
|
||||
"!**/dev/**/*.go",
|
||||
},
|
||||
},
|
||||
}
|
||||
analyzer, err := depguard.NewAnalyzer(settings)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to create deprecated logging analyzer: %v", err))
|
||||
}
|
||||
analyzer.Name = "logging"
|
||||
|
||||
return nolint.Wrap(analyzer)
|
||||
}
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc"
|
||||
"github.com/sourcegraph/sourcegraph/schema"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
bgql "github.com/sourcegraph/sourcegraph/internal/batches/graphql"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/types/scheduler/config"
|
||||
|
||||
@ -3,7 +3,7 @@ package scheduler
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/types/scheduler/window"
|
||||
"github.com/sourcegraph/sourcegraph/internal/goroutine"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/Masterminds/semver"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"github.com/dnaeon/go-vcr/cassette"
|
||||
"github.com/dnaeon/go-vcr/recorder"
|
||||
"github.com/grafana/regexp"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc"
|
||||
"github.com/sourcegraph/sourcegraph/internal/httpcli"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
adobatches "github.com/sourcegraph/sourcegraph/internal/batches/sources/azuredevops"
|
||||
gerritbatches "github.com/sourcegraph/sourcegraph/internal/batches/sources/gerrit"
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/goware/urlx"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/sourcegraph/go-diff/diff"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc/azuredevops"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc/bitbucketcloud"
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc/bitbucketserver"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"sync"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/types/scheduler/window"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"math"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@ -14,7 +14,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"database/sql"
|
||||
"sync"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbutil"
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/schollz/progressbar/v3"
|
||||
)
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/go-github/v55/github"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/schollz/progressbar/v3"
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
load("//dev:go_defs.bzl", "go_test")
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
||||
load("//dev:go_defs.bzl", "go_test")
|
||||
|
||||
go_library(
|
||||
name = "git-combine_lib",
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
"io/fs"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"math"
|
||||
"math/rand"
|
||||
"os"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -2,7 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"os"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/jsonc"
|
||||
|
||||
@ -13,7 +13,7 @@ import (
|
||||
"image/color"
|
||||
"image/png"
|
||||
"io"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"net/http"
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
@ -14,7 +14,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
)
|
||||
|
||||
@ -5,7 +5,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ package conf
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ package conf
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/regexp"
|
||||
"github.com/inconshreveable/log15"
|
||||
"github.com/inconshreveable/log15" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf/conftypes"
|
||||
)
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"database/sql"
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"log"
|
||||
"log" //nolint:logging // TODO move all logging to sourcegraph/log
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user