Skip to content

Commit 4299f0d

Browse files
authored
Merge pull request #70 from getlantern/fix-build-3
fix build
2 parents 3188dc7 + f3457cf commit 4299f0d

File tree

6 files changed

+11
-19
lines changed

6 files changed

+11
-19
lines changed

.github/workflows/push.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,5 @@ jobs:
5555
build-args: |
5656
VERSION=${{ github.ref_name }}
5757
COMMIT=${{ github.sha }}
58-
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
5958
tags: |
6059
us-docker.pkg.dev/lantern-cloud/containers/sing-box:latest

.github/workflows/push_branch.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,5 @@ jobs:
4343
build-args: |
4444
VERSION=${{ github.ref_name }}
4545
COMMIT=${{ github.sha }}
46-
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
4746
tags: |
4847
us-docker.pkg.dev/lantern-cloud/containers/sing-box:${{ github.ref_name }}

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ ARG TARGETOS TARGETARCH
33
ARG GOPROXY=""
44
ARG VERSION=""
55
ARG COMMIT=""
6-
ARG BUILD_DATE=""
76

87
RUN set -ex \
98
&& apt-get update \
@@ -29,7 +28,7 @@ RUN set -ex \
2928
fi && \
3029
echo "Building for $GOOS/$GOARCH using CC=$CC CXX=$CXX" && \
3130
go build -v -tags "with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api" \
32-
-ldflags="-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.buildDate=${BUILD_DATE}" \
31+
-ldflags="-X main.version=${VERSION} -X main.commit=${COMMIT}" \
3332
-o /usr/local/bin/lantern-box ./cmd
3433

3534
FROM debian:bullseye-slim

cmd/cmd_run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func closeMonitor(ctx context.Context) {
113113
}
114114

115115
func run(configPath string) error {
116-
log.Info("build info: version=%s, commit=%s, buildDate=%s", version, commit, buildDate)
116+
log.Info("build info: version=%s, commit=%s", version, commit)
117117
osSignals := make(chan os.Signal, 1)
118118
signal.Notify(osSignals, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
119119
defer signal.Stop(osSignals)

cmd/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ type ProxyInfo struct {
2424

2525
var globalCtx context.Context
2626
var (
27-
version string
28-
commit string
29-
buildDate string
27+
version string
28+
commit string
3029
)
3130

3231
var rootCmd = &cobra.Command{

otel/otel.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77
"time"
88

9-
"github.com/getlantern/golog"
9+
"github.com/sagernet/sing-box/log"
1010
sdkotel "go.opentelemetry.io/otel"
1111
"go.opentelemetry.io/otel/attribute"
1212
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp"
@@ -16,10 +16,6 @@ import (
1616
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
1717
)
1818

19-
var (
20-
log = golog.LoggerFor("otel")
21-
)
22-
2319
type Opts struct {
2420
Endpoint string
2521
Headers map[string]string
@@ -62,7 +58,7 @@ func InitGlobalMeterProvider(opts *Opts) (func(), error) {
6258

6359
// If endpoint doesn't use port 443, assume insecure (HTTP not HTTPS)
6460
if !strings.Contains(opts.Endpoint, ":443") {
65-
log.Debugf("Using insecure connection for OTEL metrics endpoint %v", opts.Endpoint)
61+
log.Debug("Using insecure connection for OTEL metrics endpoint %v", opts.Endpoint)
6662
metricOpts = append(metricOpts, otlpmetrichttp.WithInsecure())
6763
}
6864

@@ -85,7 +81,7 @@ func InitGlobalMeterProvider(opts *Opts) (func(), error) {
8581
defer cancel()
8682
err := mp.Shutdown(ctx)
8783
if err != nil {
88-
log.Errorf("error shutting down meter provider: %v", err)
84+
log.Error("error shutting down meter provider: %v", err)
8985
}
9086
}, nil
9187
}
@@ -101,19 +97,19 @@ func (opts *Opts) buildResource() *resource.Resource {
10197
attributes = append(attributes, attribute.String("track", opts.Track))
10298
}
10399
if opts.ProxyName != "" {
104-
log.Debugf("Will report with proxy.name %v", opts.ProxyName)
100+
log.Debug("Will report with proxy.name %v", opts.ProxyName)
105101
attributes = append(attributes, attribute.String("proxy.name", opts.ProxyName))
106102
}
107103
if opts.Provider != "" {
108-
log.Debugf("Will report with provider %v", opts.Provider)
104+
log.Debug("Will report with provider %v", opts.Provider)
109105
attributes = append(attributes, attribute.String("provider", opts.Provider))
110106
}
111107
if opts.DC != "" {
112-
log.Debugf("Will report with dc %v", opts.DC)
108+
log.Debug("Will report with dc %v", opts.DC)
113109
attributes = append(attributes, attribute.String("dc", opts.DC))
114110
}
115111
if opts.FrontendProvider != "" {
116-
log.Debugf("Will report frontend provider %v in dc %v", opts.FrontendProvider, opts.FrontendDC)
112+
log.Debug("Will report frontend provider %v in dc %v", opts.FrontendProvider, opts.FrontendDC)
117113
attributes = append(attributes, attribute.String("frontend.provider", opts.FrontendProvider))
118114
attributes = append(attributes, attribute.String("frontend.dc", opts.FrontendDC))
119115
}

0 commit comments

Comments
 (0)