Skip to content

Commit 3c7b649

Browse files
committed
fix: use ocpp manager v1.3, fix compile time issues, resolve mock generation
1 parent e6bfea7 commit 3c7b649

File tree

131 files changed

+6430
-23200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+6430
-23200
lines changed

.golangci.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ linters:
2323
exclusions:
2424
generated: lax
2525
paths:
26-
- ./gen
26+
- ./gen/*
2727
- ./pkg/reader
2828
formatters:
2929
settings:
@@ -32,4 +32,7 @@ formatters:
3232
- github.com/ChargePi/ChargePi-go
3333
enable:
3434
- gofmt
35-
- goimports
35+
- goimports
36+
exclusions:
37+
paths:
38+
- gen/*
File renamed without changes.

cmd/export.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
cfg "github.com/ChargePi/ChargePi-go/internal/pkg/configuration"
1010
exporter2 "github.com/ChargePi/ChargePi-go/internal/pkg/configuration/exporter"
1111
"github.com/ChargePi/ChargePi-go/internal/pkg/configuration/manager"
12-
"github.com/ChargePi/ocppManager-go/ocpp_v16"
12+
"github.com/ChargePi/ocpp-manager/ocpp_v16"
1313
"github.com/spf13/cobra"
1414
)
1515

cmd/import.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
importer2 "github.com/ChargePi/ChargePi-go/internal/pkg/configuration/importer"
1010
"github.com/ChargePi/ChargePi-go/internal/pkg/configuration/manager"
1111
"github.com/ChargePi/ChargePi-go/pkg/ocpp"
12-
"github.com/ChargePi/ocppManager-go/ocpp_v16"
12+
"github.com/ChargePi/ocpp-manager/ocpp_v16"
1313
"github.com/spf13/cobra"
1414
)
1515

cmd/root.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package cmd
22

33
import (
4+
"context"
45
"github.com/ChargePi/ChargePi-go/internal/pkg/configuration"
56
"github.com/ChargePi/ChargePi-go/pkg/observability"
67
log "github.com/sirupsen/logrus"
78
"github.com/spf13/cobra"
89
"github.com/spf13/viper"
10+
"os"
11+
"os/signal"
12+
"syscall"
913
)
1014

1115
var rootCmd = &cobra.Command{
@@ -17,7 +21,11 @@ var rootCmd = &cobra.Command{
1721

1822
func init() {
1923
cobra.OnInitialize(func() {
20-
observability.SetupLogging(log.StandardLogger(), observability.Logging{}, viper.GetBool(configuration.Debug))
24+
observability.SetupLogging(
25+
log.StandardLogger(),
26+
observability.Logging{},
27+
viper.GetBool(configuration.Debug),
28+
)
2129
})
2230

2331
rootCmd.AddCommand(runCommand())
@@ -30,7 +38,10 @@ func init() {
3038
}
3139

3240
func Execute() {
33-
err := rootCmd.Execute()
41+
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGKILL, syscall.SIGTERM)
42+
defer cancel()
43+
44+
err := rootCmd.ExecuteContext(ctx)
3445
if err != nil {
3546
log.WithError(err).Fatal("Unable to run")
3647
}

cmd/run.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ package cmd
22

33
import (
44
"context"
5-
"os"
6-
"os/signal"
7-
"syscall"
8-
95
"github.com/ChargePi/ChargePi-go/internal/api/grpc"
106
"github.com/ChargePi/ChargePi-go/internal/api/http"
117
"github.com/ChargePi/ChargePi-go/internal/auth"
@@ -19,7 +15,7 @@ import (
1915
"github.com/ChargePi/ChargePi-go/internal/sessions"
2016
"github.com/ChargePi/ChargePi-go/internal/users"
2117
"github.com/ChargePi/ChargePi-go/pkg/observability"
22-
"github.com/ChargePi/ocppManager-go/ocpp_v16"
18+
"github.com/ChargePi/ocpp-manager/ocpp_v16"
2319
"github.com/lorenzodonini/ocpp-go/ocpp1.6/core"
2420
log "github.com/sirupsen/logrus"
2521
"github.com/spf13/cobra"
@@ -43,10 +39,7 @@ func runCommand() *cobra.Command {
4339
Run: func(cmd *cobra.Command, args []string) {
4440
debug := viper.GetBool(configuration.Debug)
4541
runtimeSettings := configuration.GetRuntimeSettings()
46-
47-
// Run the charge point
48-
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGKILL, syscall.SIGTERM)
49-
defer cancel()
42+
ctx := cmd.Context()
5043

5144
// Create a logger
5245
logger := log.StandardLogger()
Lines changed: 88 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)