chore: remove cmd/frontend/external redirection package (#64070)

This package is no longer required now that everything that depends on
session is inside cmd/frontend. This removes one layer of indirection in
the code nav flow.

Test plan: Just removed aliases and pointed to the original code, and
the Go compiler doesn't complain.
This commit is contained in:
Erik Seliger 2024-07-31 04:41:59 +02:00 committed by GitHub
parent e6d4801b20
commit eee2053b47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 33 additions and 77 deletions

View File

@ -1,8 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "external",
srcs = ["doc.go"],
importpath = "github.com/sourcegraph/sourcegraph/cmd/frontend/external",
visibility = ["//visibility:public"],
)

View File

@ -1,4 +0,0 @@
// Package external is a parent package whose sub-packages exist solely to
// export certain types and variables from internal packages. An internal
// package should *never* import a sub-package of this package.
package external

View File

@ -1,9 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "session",
srcs = ["session.go"],
importpath = "github.com/sourcegraph/sourcegraph/cmd/frontend/external/session",
visibility = ["//visibility:public"],
deps = ["//cmd/frontend/internal/auth/session"],
)

View File

@ -1,22 +0,0 @@
// Package session exports symbols from frontend/internal/session. See the
// parent package godoc for more information.
package session
import "github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
var (
ResetMockSessionStore = session.ResetMockSessionStore
// SetActor sets the actor in the session, or removes it if actor == nil. If no session exists, a
// new session is created.
//
// 🚨 SECURITY: Should only be called after user is successfully authenticated.
SetActor = session.SetActor
// SetActorFromUser creates an actor from a user, sets it in the session, and
// returns a context with the user attached.
//
// 🚨 SECURITY: Should only be called after user is successfully authenticated.
SetActorFromUser = session.SetActorFromUser
SetData = session.SetData
GetData = session.GetData
InvalidateSessionsByIDs = session.InvalidateSessionsByIDs
)

View File

@ -237,13 +237,13 @@ go_library(
"//cmd/frontend/auth",
"//cmd/frontend/backend",
"//cmd/frontend/envvar",
"//cmd/frontend/external/session",
"//cmd/frontend/globals",
"//cmd/frontend/graphqlbackend/externallink",
"//cmd/frontend/graphqlbackend/graphqlutil",
"//cmd/frontend/hubspot",
"//cmd/frontend/hubspot/hubspotutil",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//cmd/frontend/internal/auth/sourcegraphoperator",
"//cmd/frontend/internal/auth/userpasswd",
"//cmd/frontend/internal/cloneurls",

View File

@ -6,7 +6,7 @@ import (
"github.com/graph-gophers/graphql-go"
"github.com/sourcegraph/log"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/auth"
"github.com/sourcegraph/sourcegraph/internal/authz"

View File

@ -7,7 +7,7 @@ go_library(
visibility = ["//cmd/frontend:__subpackages__"],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/database",
],

View File

@ -6,7 +6,7 @@ import (
"time"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/database"
)

View File

@ -13,10 +13,10 @@ go_library(
visibility = ["//cmd/frontend:__subpackages__"],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/hubspot",
"//cmd/frontend/internal/auth/oauth",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/collections",
"//internal/conf",

View File

@ -10,10 +10,10 @@ import (
"github.com/sourcegraph/log"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/hubspot"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/oauth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/database"
"github.com/sourcegraph/sourcegraph/internal/extsvc"

View File

@ -13,7 +13,6 @@ go_library(
visibility = ["//cmd/frontend:__subpackages__"],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/hubspot",
"//cmd/frontend/hubspot/hubspotutil",
"//cmd/frontend/internal/auth/oauth",
@ -56,9 +55,9 @@ go_test(
],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/internal/auth/oauth",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/conf",
"//internal/database",

View File

@ -17,9 +17,9 @@ import (
"github.com/sourcegraph/log/logtest"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/oauth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/database"
"github.com/sourcegraph/sourcegraph/internal/database/dbmocks"

View File

@ -13,8 +13,8 @@ import (
"github.com/sourcegraph/log"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/oauth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/database"
"github.com/sourcegraph/sourcegraph/internal/extsvc"
"github.com/sourcegraph/sourcegraph/internal/lazyregexp"

View File

@ -13,11 +13,11 @@ go_library(
visibility = ["//cmd/frontend:__subpackages__"],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/hubspot",
"//cmd/frontend/hubspot/hubspotutil",
"//cmd/frontend/internal/auth/oauth",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/collections",
"//internal/conf",
@ -60,9 +60,9 @@ go_test(
],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/internal/auth/oauth",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/conf",
"//internal/database",

View File

@ -15,9 +15,9 @@ import (
"github.com/sourcegraph/log/logtest"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/oauth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/conf"
"github.com/sourcegraph/sourcegraph/internal/database"

View File

@ -16,11 +16,11 @@ import (
"github.com/sourcegraph/log"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/hubspot"
"github.com/sourcegraph/sourcegraph/cmd/frontend/hubspot/hubspotutil"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/oauth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/conf"
"github.com/sourcegraph/sourcegraph/internal/database"

View File

@ -15,11 +15,11 @@ go_library(
visibility = ["//cmd/frontend:__subpackages__"],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/hubspot",
"//cmd/frontend/hubspot/hubspotutil",
"//cmd/frontend/internal/auth/oauth",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/collections",
"//internal/conf",
@ -55,9 +55,9 @@ go_test(
],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/internal/auth/oauth",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/conf",
"//internal/database",

View File

@ -15,9 +15,9 @@ import (
"github.com/sourcegraph/log/logtest"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/oauth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/conf"
"github.com/sourcegraph/sourcegraph/internal/database"

View File

@ -12,11 +12,11 @@ import (
"github.com/sourcegraph/log"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/hubspot"
"github.com/sourcegraph/sourcegraph/cmd/frontend/hubspot/hubspotutil"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/oauth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/conf"
"github.com/sourcegraph/sourcegraph/internal/database"

View File

@ -14,9 +14,9 @@ go_library(
visibility = ["//cmd/frontend:__subpackages__"],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/hubspot",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/conf",
"//internal/cookie",

View File

@ -13,8 +13,8 @@ import (
"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"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/conf"
"github.com/sourcegraph/sourcegraph/internal/extsvc"
"github.com/sourcegraph/sourcegraph/internal/extsvc/azuredevops"

View File

@ -13,9 +13,9 @@ import (
"github.com/sourcegraph/log"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/hubspot"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/cookie"
"github.com/sourcegraph/sourcegraph/internal/database"

View File

@ -14,10 +14,10 @@ go_library(
visibility = ["//cmd/frontend:__subpackages__"],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/hubspot",
"//cmd/frontend/hubspot/hubspotutil",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/conf",
"//internal/conf/conftypes",
@ -55,9 +55,9 @@ go_test(
tags = [TAG_PLATFORM_SOURCE],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/hubspot",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/conf",
"//internal/database",

View File

@ -19,9 +19,9 @@ import (
"github.com/sourcegraph/log"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/hubspot"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
sgactor "github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/cookie"
"github.com/sourcegraph/sourcegraph/internal/database"

View File

@ -19,8 +19,8 @@ import (
"github.com/sourcegraph/log/logtest"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/database"
"github.com/sourcegraph/sourcegraph/internal/database/dbmocks"

View File

@ -7,8 +7,8 @@ import (
sams "github.com/sourcegraph/sourcegraph-accounts-sdk-go"
"github.com/sourcegraph/sourcegraph-accounts-sdk-go/scopes"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/dotcom"
"github.com/sourcegraph/sourcegraph/lib/errors"
)

View File

@ -15,8 +15,8 @@ go_library(
visibility = ["//cmd/frontend:__subpackages__"],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/conf",
"//internal/conf/conftypes",
@ -51,8 +51,8 @@ go_test(
tags = [TAG_PLATFORM_SOURCE],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/conf",
"//internal/database/dbmocks",

View File

@ -12,8 +12,8 @@ import (
"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"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
sgactor "github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/database"
)

View File

@ -22,8 +22,8 @@ import (
"github.com/crewjam/saml/samlidp"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/conf"
"github.com/sourcegraph/sourcegraph/internal/database/dbmocks"

View File

@ -13,9 +13,9 @@ go_library(
visibility = ["//cmd/frontend:__subpackages__"],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/internal/auth/openidconnect",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/auth",
"//internal/cloud",
@ -47,9 +47,9 @@ go_test(
],
deps = [
"//cmd/frontend/auth",
"//cmd/frontend/external/session",
"//cmd/frontend/internal/auth/openidconnect",
"//cmd/frontend/internal/auth/providers",
"//cmd/frontend/internal/auth/session",
"//internal/actor",
"//internal/auth",
"//internal/cloud",

View File

@ -8,9 +8,9 @@ import (
"github.com/sourcegraph/log"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/openidconnect"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
internalauth "github.com/sourcegraph/sourcegraph/internal/auth"
"github.com/sourcegraph/sourcegraph/internal/database"

View File

@ -19,9 +19,9 @@ import (
"github.com/stretchr/testify/require"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/external/session"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/openidconnect"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/session"
"github.com/sourcegraph/sourcegraph/internal/actor"
internalauth "github.com/sourcegraph/sourcegraph/internal/auth"
"github.com/sourcegraph/sourcegraph/internal/cloud"