Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: package hierarchy #5

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module github.com/moderato-app/live-pprof

go 1.22.6

replace live-pprof => ./go

require live-pprof v0.0.0-00010101000000-000000000000

require (
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/go-chi/chi/v5 v5.1.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/klauspost/compress v1.11.7 // indirect
github.com/moderato-app/pprof v0.0.0-20240823224210-78ccd2f4d170 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
nhooyr.io/websocket v1.8.6 // indirect
)
520 changes: 520 additions & 0 deletions go.sum

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions go/cmd/live-pprof/live-pprof.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package main

import (
livepprof "github.com/moderato-app/go/live-pprof/internal"
)
import "live-pprof/pkg"

func main() {
livepprof.LivePprof()
pkg.LivePprof()
}
2 changes: 1 addition & 1 deletion go/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/moderato-app/go/live-pprof
module live-pprof

go 1.22.6

Expand Down
5 changes: 3 additions & 2 deletions go/internal/chi/chi_web_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"net/http/pprof"
_ "net/http/pprof"

"live-pprof/assets"
"live-pprof/internal/logging"

"github.com/go-chi/chi/v5"
chiMiddleware "github.com/go-chi/chi/v5/middleware"
"github.com/improbable-eng/grpc-web/go/grpcweb"
"github.com/moderato-app/go/live-pprof/assets"
"github.com/moderato-app/go/live-pprof/internal/logging"
)

func WebServer(g *grpcweb.WrappedGrpcServer) *chi.Mux {
Expand Down
3 changes: 2 additions & 1 deletion go/internal/config/live-pprof-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"fmt"
"os"

"github.com/moderato-app/go/live-pprof/internal/logging"
"live-pprof/internal/logging"

flag "github.com/spf13/pflag"
)

Expand Down
5 changes: 3 additions & 2 deletions go/internal/echo/echo_web_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"io/fs"
"net/http"

"live-pprof/assets"
"live-pprof/internal/logging"

"github.com/brpaz/echozap"
"github.com/improbable-eng/grpc-web/go/grpcweb"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/labstack/gommon/log"
"github.com/moderato-app/go/live-pprof/assets"
"github.com/moderato-app/go/live-pprof/internal/logging"
)

func WebServer(g *grpcweb.WrappedGrpcServer) *echo.Echo {
Expand Down
6 changes: 3 additions & 3 deletions go/internal/general/general_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"sync"
"time"

"github.com/moderato-app/go/live-pprof/api"
"github.com/moderato-app/go/live-pprof/internal/logging"
"github.com/moderato-app/go/live-pprof/internal/metrics"
"live-pprof/api"
"live-pprof/internal/logging"
"live-pprof/internal/metrics"
)

type GeneralServer struct {
Expand Down
5 changes: 3 additions & 2 deletions go/internal/metrics/metrics_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"net/http"
"time"

"github.com/moderato-app/go/live-pprof/api"
"github.com/moderato-app/go/live-pprof/internal/logging"
"live-pprof/api"
"live-pprof/internal/logging"

"github.com/moderato-app/pprof/moderato"
)

Expand Down
5 changes: 3 additions & 2 deletions go/internal/metrics/mock_assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
"sync"
"sync/atomic"

"github.com/moderato-app/go/live-pprof/assets"
"github.com/moderato-app/go/live-pprof/internal/logging"
"live-pprof/assets"
"live-pprof/internal/logging"

"github.com/moderato-app/pprof/moderato"
)

Expand Down
4 changes: 2 additions & 2 deletions go/internal/metrics/mock_metrics_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package metrics
import (
"context"

"github.com/moderato-app/go/live-pprof/api"
"github.com/moderato-app/go/live-pprof/internal/logging"
"live-pprof/api"
"live-pprof/internal/logging"
)

// MockMetricsServer returns mock data instead of real data to save development time
Expand Down
4 changes: 2 additions & 2 deletions go/internal/metrics/mock_metrics_server_prod.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"context"
"errors"

"github.com/moderato-app/go/live-pprof/api"
"github.com/moderato-app/go/live-pprof/internal/logging"
"live-pprof/api"
"live-pprof/internal/logging"
)

var mockNotAvailableErr = errors.New("mock data is not available for a prod build")
Expand Down
7 changes: 4 additions & 3 deletions go/internal/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import (
"syscall"
"time"

chi2 "live-pprof/internal/chi"
"live-pprof/internal/config"
"live-pprof/internal/logging"

"github.com/improbable-eng/grpc-web/go/grpcweb"
chi2 "github.com/moderato-app/go/live-pprof/internal/chi"
"github.com/moderato-app/go/live-pprof/internal/config"
"github.com/moderato-app/go/live-pprof/internal/logging"
"google.golang.org/grpc"
)

Expand Down
6 changes: 2 additions & 4 deletions go/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package main

import (
"github.com/moderato-app/go/live-pprof/internal"
)
import "live-pprof/pkg"

func main() {
internal.LivePprof()
pkg.LivePprof()
}
18 changes: 10 additions & 8 deletions go/internal/live-pprof.go → go/pkg/live-pprof.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package internal
package pkg

import (
"net/url"
"strconv"
"strings"
"time"

"github.com/moderato-app/go/live-pprof/api"
"github.com/moderato-app/go/live-pprof/internal/config"
"github.com/moderato-app/go/live-pprof/internal/general"
"github.com/moderato-app/go/live-pprof/internal/logging"
"github.com/moderato-app/go/live-pprof/internal/metrics"
"github.com/moderato-app/go/live-pprof/internal/util"
"live-pprof/api"
"live-pprof/internal"
"live-pprof/internal/config"
"live-pprof/internal/general"
"live-pprof/internal/logging"
"live-pprof/internal/metrics"
"live-pprof/internal/util"

"github.com/pkg/browser"
"google.golang.org/grpc"
)
Expand All @@ -31,7 +33,7 @@ func LivePprof() {
maybeOpenURL(conf)
}()

StartServeGrpc(grpcServer, conf)
internal.StartServeGrpc(grpcServer, conf)
}

func maybeOpenURL(conf *config.LivePprofConfig) {
Expand Down
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "live-pprof/pkg"

func main() {
pkg.LivePprof()
}
Loading