Skip to content

Commit

Permalink
Update deps (#631)
Browse files Browse the repository at this point in the history
* Install latest version of OpenSSL to fix CVE-2024-9143
* Update action
* Fix linter error
* Convert all function to pointer receivers
  • Loading branch information
mostafa authored Nov 11, 2024
1 parent 7f47dca commit 6184a83
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
version: v1
args: mod -json -licenses -output gatewayd-source-${{ github.ref_name }}.cyclonedx.json
- name: Create release and add artifacts
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ARG TARGETPLATFORM
WORKDIR /gatewayd
COPY . /gatewayd

RUN apk --no-cache add git=2.45.2-r0 make=4.4.1-r2 && \
RUN apk --no-cache add git=2.45.2-r0 make=4.4.1-r2 openssl=3.3.2-r1 && \
mkdir -p dist && \
make build-platform GOOS=${TARGETOS} GOARCH=${TARGETARCH} OUTPUT_DIR=dist/${TARGETOS}-${TARGETARCH}

Expand Down
40 changes: 20 additions & 20 deletions logging/hclog_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type HcLogAdapter struct {
impliedArgs []any
}

func (h HcLogAdapter) Log(level hclog.Level, msg string, args ...any) {
func (h *HcLogAdapter) Log(level hclog.Level, msg string, args ...any) {
switch level {
case hclog.Off:
return
Expand All @@ -41,37 +41,37 @@ func (h HcLogAdapter) Log(level hclog.Level, msg string, args ...any) {
}
}

func (h HcLogAdapter) Trace(msg string, args ...any) {
func (h *HcLogAdapter) Trace(msg string, args ...any) {
extraArgs := ToMap(args)
extraArgs["plugin"] = h.name
h.logger.Trace().Fields(extraArgs).Msg(msg)
}

func (h HcLogAdapter) Debug(msg string, args ...any) {
func (h *HcLogAdapter) Debug(msg string, args ...any) {
extraArgs := ToMap(args)
extraArgs["plugin"] = h.name
h.logger.Debug().Fields(extraArgs).Msg(msg)
}

func (h HcLogAdapter) Info(msg string, args ...any) {
func (h *HcLogAdapter) Info(msg string, args ...any) {
extraArgs := ToMap(args)
extraArgs["plugin"] = h.name
h.logger.Info().Fields(extraArgs).Msg(msg)
}

func (h HcLogAdapter) Warn(msg string, args ...any) {
func (h *HcLogAdapter) Warn(msg string, args ...any) {
extraArgs := ToMap(args)
extraArgs["plugin"] = h.name
h.logger.Warn().Fields(extraArgs).Msg(msg)
}

func (h HcLogAdapter) Error(msg string, args ...any) {
func (h *HcLogAdapter) Error(msg string, args ...any) {
extraArgs := ToMap(args)
extraArgs["plugin"] = h.name
h.logger.Error().Fields(extraArgs).Msg(msg)
}

func (h HcLogAdapter) GetLevel() hclog.Level {
func (h *HcLogAdapter) GetLevel() hclog.Level {
switch h.logger.GetLevel() {
case zerolog.Disabled:
return hclog.Off
Expand All @@ -95,61 +95,61 @@ func (h HcLogAdapter) GetLevel() hclog.Level {
return hclog.NoLevel
}

func (h HcLogAdapter) IsTrace() bool {
func (h *HcLogAdapter) IsTrace() bool {
return h.logger.GetLevel() >= zerolog.TraceLevel
}

func (h HcLogAdapter) IsDebug() bool {
func (h *HcLogAdapter) IsDebug() bool {
return h.logger.GetLevel() >= zerolog.DebugLevel
}

func (h HcLogAdapter) IsInfo() bool {
func (h *HcLogAdapter) IsInfo() bool {
return h.logger.GetLevel() >= zerolog.InfoLevel
}

func (h HcLogAdapter) IsWarn() bool {
func (h *HcLogAdapter) IsWarn() bool {
return h.logger.GetLevel() >= zerolog.WarnLevel
}

func (h HcLogAdapter) IsError() bool {
func (h *HcLogAdapter) IsError() bool {
return h.logger.GetLevel() >= zerolog.ErrorLevel
}

func (h HcLogAdapter) ImpliedArgs() []any {
func (h *HcLogAdapter) ImpliedArgs() []any {
// Not supported
return nil
}

func (h HcLogAdapter) With(args ...any) hclog.Logger {
func (h *HcLogAdapter) With(args ...any) hclog.Logger {
logger := h.logger.With().Fields(ToMap(args)).Logger()
return NewHcLogAdapter(&logger, h.Name())
}

func (h HcLogAdapter) Name() string {
func (h *HcLogAdapter) Name() string {
return h.name
}

func (h HcLogAdapter) Named(name string) hclog.Logger {
func (h *HcLogAdapter) Named(name string) hclog.Logger {
return NewHcLogAdapter(h.logger, name)
}

func (h HcLogAdapter) ResetNamed(_ string) hclog.Logger {
return &h
func (h *HcLogAdapter) ResetNamed(_ string) hclog.Logger {
return h
}

func (h *HcLogAdapter) SetLevel(level hclog.Level) {
leveledLog := h.logger.Level(convertLevel(level))
h.logger = &leveledLog
}

func (h HcLogAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger {
func (h *HcLogAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger {
if opts == nil {
opts = &hclog.StandardLoggerOptions{}
}
return log.New(h.StandardWriter(opts), "", 0)
}

func (h HcLogAdapter) StandardWriter(_ *hclog.StandardLoggerOptions) io.Writer {
func (h *HcLogAdapter) StandardWriter(_ *hclog.StandardLoggerOptions) io.Writer {
v := reflect.ValueOf(h.logger)
w := v.FieldByName("w")
writer, ok := w.Interface().(zerolog.LevelWriter)
Expand Down
6 changes: 2 additions & 4 deletions pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,13 @@ func (p *Pool) Cap() int {
}

// NewPool creates a new pool with the given capacity.
//
//nolint:predeclared
func NewPool(ctx context.Context, cap int) *Pool {
func NewPool(ctx context.Context, capacity int) *Pool {
poolCtx, span := otel.Tracer(config.TracerName).Start(ctx, "NewPool")
defer span.End()

return &Pool{
pool: sync.Map{},
cap: cap,
cap: capacity,
ctx: poolCtx,
}
}

0 comments on commit 6184a83

Please sign in to comment.