Skip to content

Commit

Permalink
refactor: move packages to internal (#626)
Browse files Browse the repository at this point in the history
Clean up the root directory and move all non-public packages (all except
`cmd`) into the `internal` namespace.
  • Loading branch information
jooola authored Jun 21, 2024
1 parent 35034a6 commit c53658e
Show file tree
Hide file tree
Showing 34 changed files with 38 additions and 43 deletions.
7 changes: 1 addition & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
*
!api/
!app/
!cmd/
!csi/
!driver/
!metrics/
!volumes/
!internal/
!go.mod
!go.sum
8 changes: 4 additions & 4 deletions cmd/aio/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"

"github.com/hetznercloud/csi-driver/api"
"github.com/hetznercloud/csi-driver/app"
"github.com/hetznercloud/csi-driver/driver"
"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/api"
"github.com/hetznercloud/csi-driver/internal/app"
"github.com/hetznercloud/csi-driver/internal/driver"
"github.com/hetznercloud/csi-driver/internal/volumes"
"github.com/hetznercloud/hcloud-go/v2/hcloud/metadata"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"

"github.com/hetznercloud/csi-driver/api"
"github.com/hetznercloud/csi-driver/app"
"github.com/hetznercloud/csi-driver/driver"
"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/api"
"github.com/hetznercloud/csi-driver/internal/app"
"github.com/hetznercloud/csi-driver/internal/driver"
"github.com/hetznercloud/csi-driver/internal/volumes"
"github.com/hetznercloud/hcloud-go/v2/hcloud/metadata"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"

"github.com/hetznercloud/csi-driver/app"
"github.com/hetznercloud/csi-driver/driver"
"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/app"
"github.com/hetznercloud/csi-driver/internal/driver"
"github.com/hetznercloud/csi-driver/internal/volumes"
"github.com/hetznercloud/hcloud-go/v2/hcloud/metadata"
)

Expand Down
2 changes: 1 addition & 1 deletion api/helper.go → internal/api/helper.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package api

import (
"github.com/hetznercloud/csi-driver/csi"
"github.com/hetznercloud/csi-driver/internal/csi"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
)

Expand Down
4 changes: 2 additions & 2 deletions api/volume.go → internal/api/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"

"github.com/hetznercloud/csi-driver/csi"
"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/csi"
"github.com/hetznercloud/csi-driver/internal/volumes"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
)

Expand Down
4 changes: 2 additions & 2 deletions api/volume_test.go → internal/api/volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/go-kit/log"
"github.com/stretchr/testify/assert"

"github.com/hetznercloud/csi-driver/csi"
"github.com/hetznercloud/csi-driver/internal/csi"
"github.com/hetznercloud/csi-driver/internal/mocked"
"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/volumes"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/hetznercloud/hcloud-go/v2/hcloud/schema"
)
Expand Down
4 changes: 2 additions & 2 deletions app/app.go → internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"github.com/prometheus/client_golang/prometheus"
"google.golang.org/grpc"

"github.com/hetznercloud/csi-driver/driver"
"github.com/hetznercloud/csi-driver/metrics"
"github.com/hetznercloud/csi-driver/internal/driver"
"github.com/hetznercloud/csi-driver/internal/metrics"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
"github.com/hetznercloud/hcloud-go/v2/hcloud/metadata"
)
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions driver/controller.go → internal/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/hetznercloud/csi-driver/csi"
"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/csi"
"github.com/hetznercloud/csi-driver/internal/volumes"
)

type ControllerService struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/hetznercloud/csi-driver/csi"
"github.com/hetznercloud/csi-driver/mock"
"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/csi"
"github.com/hetznercloud/csi-driver/internal/mock"
"github.com/hetznercloud/csi-driver/internal/volumes"
)

var _ proto.ControllerServer = (*ControllerService)(nil)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion driver/node.go → internal/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/volumes"
)

type NodeService struct {
Expand Down
4 changes: 2 additions & 2 deletions driver/node_test.go → internal/driver/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/hetznercloud/csi-driver/mock"
"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/mock"
"github.com/hetznercloud/csi-driver/internal/volumes"
)

var _ proto.NodeServer = (*NodeService)(nil)
Expand Down
4 changes: 2 additions & 2 deletions driver/sanity_test.go → internal/driver/sanity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/kubernetes-csi/csi-test/v5/pkg/sanity"
"google.golang.org/grpc"

"github.com/hetznercloud/csi-driver/csi"
"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/csi"
"github.com/hetznercloud/csi-driver/internal/volumes"
)

func TestSanity(t *testing.T) {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions mock/volume.go → internal/mock/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package mock
import (
"context"

"github.com/hetznercloud/csi-driver/csi"
"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/csi"
"github.com/hetznercloud/csi-driver/internal/volumes"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion volumes/idempotency.go → internal/volumes/idempotency.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"

"github.com/hetznercloud/csi-driver/csi"
"github.com/hetznercloud/csi-driver/internal/csi"
)

// IdempotentService wraps a volume service and provides idempotency as required by the CSI spec.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

"github.com/go-kit/log"

"github.com/hetznercloud/csi-driver/csi"
"github.com/hetznercloud/csi-driver/mock"
"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/csi"
"github.com/hetznercloud/csi-driver/internal/mock"
"github.com/hetznercloud/csi-driver/internal/volumes"
)

var _ volumes.Service = (*volumes.IdempotentService)(nil)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion volumes/service.go → internal/volumes/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"errors"

"github.com/hetznercloud/csi-driver/csi"
"github.com/hetznercloud/csi-driver/internal/csi"
)

var (
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/integration/cryptsetup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/go-kit/log"

"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/volumes"
)

func TestCryptSetup(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/volumes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/go-kit/log"

"github.com/hetznercloud/csi-driver/volumes"
"github.com/hetznercloud/csi-driver/internal/volumes"
)

func TestVolumePublishUnpublish(t *testing.T) {
Expand Down

0 comments on commit c53658e

Please sign in to comment.