chore: use gofumpt for code formatting

This commit is contained in:
Quentin McGaw
2024-10-11 19:20:48 +00:00
parent 3daf15a612
commit 76a4bb5dc3
289 changed files with 784 additions and 548 deletions

View File

@@ -34,7 +34,8 @@ type Loop struct {
func NewLoop(settings settings.PortForwarding, routing Routing,
client *http.Client, portAllower PortAllower,
logger Logger, uid, gid int) *Loop {
logger Logger, uid, gid int,
) *Loop {
return &Loop{
settings: Settings{
VPNIsUp: ptrTo(false),
@@ -75,7 +76,8 @@ func (l *Loop) Start(_ context.Context) (runError <-chan error, _ error) {
func (l *Loop) run(runCtx context.Context, runDone chan<- struct{},
runErrorCh chan<- error, updateTrigger <-chan Settings,
updateResult chan<- error) {
updateResult chan<- error,
) {
defer close(runDone)
var serviceRunError <-chan error

View File

@@ -15,7 +15,7 @@ func (s *Service) writePortForwardedFile(ports []uint16) (err error) {
filepath := s.settings.Filepath
s.logger.Info("writing port file " + filepath)
const perms = os.FileMode(0644)
const perms = os.FileMode(0o644)
err = os.WriteFile(filepath, fileData, perms)
if err != nil {
return fmt.Errorf("writing file: %w", err)

View File

@@ -26,7 +26,8 @@ type Service struct {
}
func New(settings Settings, routing Routing, client *http.Client,
portAllower PortAllower, logger Logger, puid, pgid int) *Service {
portAllower PortAllower, logger Logger, puid, pgid int,
) *Service {
return &Service{
// Fixed parameters
settings: settings,

View File

@@ -82,7 +82,8 @@ func (s *Service) Start(ctx context.Context) (runError <-chan error, err error)
readyCh := make(chan struct{})
go func(ctx context.Context, portForwarder PortForwarder,
obj utils.PortForwardObjects, readyCh chan<- struct{},
runError chan<- error, doneCh chan<- struct{}) {
runError chan<- error, doneCh chan<- struct{},
) {
defer close(doneCh)
close(readyCh)
err = portForwarder.KeepPortForward(ctx, obj)

View File

@@ -18,7 +18,8 @@ type Settings struct {
// and returns them if they are valid, or returns an error otherwise.
// In all cases, the receiving settings are unmodified.
func (s Settings) updateWith(partialUpdate Settings,
forStartup bool) (updated Settings, err error) {
forStartup bool,
) (updated Settings, err error) {
updated = s.copy()
updated.overrideWith(partialUpdate)
err = updated.validate(forStartup)