Skip to content

Commit 937e6ac

Browse files
authored
Merge branch 'main' into dependabot/go_modules/github.com/prometheus/client_golang-1.20.5
Signed-off-by: Ian Meyer <[email protected]>
2 parents 5a74ca0 + 7931561 commit 937e6ac

30 files changed

+1981
-1984
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.3.2
1+
latest

.github/workflows/golangci-lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
- uses: actions/checkout@v4
2121
- uses: actions/setup-go@v5
2222
with:
23-
go-version: '1.23.2'
23+
go-version: 1.24.2
2424
cache: false
2525
- name: golangci-lint
26-
uses: golangci/golangci-lint-action@v6
26+
uses: golangci/golangci-lint-action@v7
2727
with:
2828
# Require: The version of golangci-lint to use.
2929
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
3030
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
31-
version: v1.60.3
31+
version: v2.0
3232

3333
# Optional: working directory, useful for monorepos
3434
# working-directory: somedir
@@ -37,7 +37,7 @@ jobs:
3737
#
3838
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
3939
# The location of the configuration file can be changed by using `--config=`
40-
args: --timeout=5m --issues-exit-code=0 --new-from-rev=origin/${{ github.base_ref }} --out-format=sarif --config=.golangci.yml
40+
args: --timeout=5m --issues-exit-code=0 --new-from-rev=origin/${{ github.base_ref }} --output.sarif.path --config=.golangci.yml
4141

4242
# Optional: show only new issues if it's a pull request. The default value is `false`.
4343
# only-new-issues: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ bazel-*
3434

3535
# Code coverage reports
3636
genhtml/
37+
38+
.idea/

.golangci.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: "2"
2+
linters:
3+
enable:
4+
- bidichk
5+
- bodyclose
6+
- canonicalheader
7+
- containedctx
8+
- contextcheck
9+
- decorder
10+
- dupl
11+
- dupword
12+
- errname
13+
- errorlint
14+
- gosec
15+
- nosprintfhostport
16+
- promlinter
17+
- sloglint
18+
- unconvert
19+
- unparam
20+
exclusions:
21+
generated: lax
22+
presets:
23+
- comments
24+
- common-false-positives
25+
- legacy
26+
- std-error-handling
27+
paths:
28+
- third_party$
29+
- builtin$
30+
- examples$
31+
formatters:
32+
enable:
33+
- gofumpt
34+
exclusions:
35+
generated: lax
36+
paths:
37+
- third_party$
38+
- builtin$
39+
- examples$

.golangci.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

BUILD.bazel

Lines changed: 83 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,72 @@
11
load("@gazelle//:def.bzl", "gazelle")
2-
load("@rules_go//go:def.bzl", "go_library", "go_test")
3-
load("helper.bzl", "cross_compile_binary")
4-
load("platforms.def.bzl", "PLATFORMS")
2+
load("@rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
3+
load("crosscompile.bzl", "create_cross_platform_targets")
54

65
gazelle(name = "gazelle")
76

8-
# Name of the binary
97
NAME = "tdiscuss"
108

9+
go_test(
10+
name = "tdiscuss_test",
11+
size = "small",
12+
srcs = [
13+
"config_test.go",
14+
"csrf_test.go",
15+
"helpers_test.go",
16+
"metrics_test.go",
17+
"parser_test.go",
18+
"server_test.go",
19+
],
20+
embed = [":tdiscuss_lib"],
21+
target_compatible_with = select({
22+
"@platforms//os:linux": [],
23+
"@platforms//os:macos": [],
24+
"//conditions:default": ["@platforms//:incompatible"],
25+
}),
26+
deps = [
27+
"@com_github_jackc_pgx_v5//:pgx",
28+
"@com_github_jackc_pgx_v5//pgtype",
29+
"@com_github_jackc_pgx_v5//pgxpool",
30+
"@com_github_stretchr_testify//assert",
31+
"@com_github_stretchr_testify//require",
32+
"@com_tailscale//client/tailscale/apitype",
33+
"@com_tailscale//ipn/ipnstate",
34+
"@com_tailscale//tailcfg",
35+
],
36+
)
37+
38+
# To allow running all tests without external deps
39+
test_suite(
40+
name = "all_tests",
41+
tests = [":tdiscuss_test"],
42+
)
43+
44+
# Default binary for the current platform
45+
go_binary(
46+
name = "tdiscuss",
47+
embed = [":tdiscuss_lib"],
48+
visibility = ["//visibility:public"],
49+
)
50+
51+
create_cross_platform_targets(
52+
name = "tdiscuss",
53+
embed = [":tdiscuss_lib"],
54+
)
55+
56+
# Define the filegroup to collect all platform binaries
57+
filegroup(
58+
name = "all_platforms",
59+
srcs = [
60+
":tdiscuss-linux-amd64",
61+
":tdiscuss-linux-arm64",
62+
":tdiscuss-darwin-amd64",
63+
":tdiscuss-darwin-arm64",
64+
],
65+
visibility = ["//visibility:public"],
66+
)
67+
1168
go_library(
12-
name = "{}_lib".format(NAME),
69+
name = "tdiscuss_lib",
1370
srcs = [
1471
"config.go",
1572
"csrf.go",
@@ -18,16 +75,19 @@ go_library(
1875
"main.go",
1976
"metrics.go",
2077
"models.go",
78+
"otel.go",
2179
"parser.go",
2280
"querier.go",
2381
"queries.sql.go",
2482
"server.go",
83+
"traced_querier.go",
2584
],
2685
embedsrcs = [
86+
"static/style.css",
2787
"tmpl/admin.html",
2888
"tmpl/edit-profile.html",
29-
"tmpl/edit-thread.html",
3089
"tmpl/edit-thread-post.html",
90+
"tmpl/edit-thread.html",
3191
"tmpl/error.html",
3292
"tmpl/footer.html",
3393
"tmpl/header.html",
@@ -37,64 +97,41 @@ go_library(
3797
"tmpl/menu.html",
3898
"tmpl/newthread.html",
3999
"tmpl/thread.html",
40-
"static/style.css",
41100
],
42-
importpath = "github.com/imeyer/{}".format(NAME),
101+
importpath = "github.com/imeyer/tdiscuss",
43102
visibility = ["//visibility:private"],
44-
x_defs = {
45-
"version": "{STABLE_VERSION}",
46-
"gitSha": "{STABLE_GIT_SHA}",
47-
},
48103
deps = [
49104
"@com_github_google_uuid//:uuid",
50105
"@com_github_jackc_pgx_v5//:pgx",
51106
"@com_github_jackc_pgx_v5//pgconn",
52107
"@com_github_jackc_pgx_v5//pgtype",
53108
"@com_github_jackc_pgx_v5//pgxpool",
54109
"@com_github_microcosm_cc_bluemonday//:bluemonday",
55-
"@com_github_prometheus_client_golang//prometheus",
56110
"@com_github_prometheus_client_golang//prometheus/promhttp",
57-
"@com_github_prometheus_client_golang//prometheus/testutil",
58111
"@com_github_yuin_goldmark//:goldmark",
59112
"@com_github_yuin_goldmark//extension",
60113
"@com_github_yuin_goldmark//renderer/html",
61114
"@com_github_yuin_goldmark_emoji//:goldmark-emoji",
62-
"@com_tailscale//client/tailscale",
63115
"@com_tailscale//client/tailscale/apitype",
64116
"@com_tailscale//hostinfo",
65117
"@com_tailscale//ipn/ipnstate",
66-
"@com_tailscale//tailcfg",
67118
"@com_tailscale//tsnet",
68119
"@com_tailscale//types/logger",
69-
],
70-
)
71-
72-
[cross_compile_binary(
73-
name = NAME,
74-
goarch = goarch,
75-
goos = goos,
76-
) for (goos, goarch) in PLATFORMS]
77-
78-
go_test(
79-
name = "tdiscuss_test",
80-
size = "small",
81-
srcs = [
82-
"config_test.go",
83-
"csrf_test.go",
84-
"helpers_test.go",
85-
"metrics_test.go",
86-
"parser_test.go",
87-
"server_test.go",
88-
],
89-
embed = [":tdiscuss_lib"],
90-
deps = [
91-
"@com_github_jackc_pgx_v5//:pgx",
92-
"@com_github_jackc_pgx_v5//pgtype",
93-
"@com_github_jackc_pgx_v5//pgxpool",
94-
"@com_github_stretchr_testify//assert",
95-
"@com_github_stretchr_testify//require",
96-
"@com_tailscale//client/tailscale/apitype",
97-
"@com_tailscale//ipn/ipnstate",
98-
"@com_tailscale//tailcfg",
120+
"@io_opentelemetry_go_contrib_bridges_otelslog//:otelslog",
121+
"@io_opentelemetry_go_contrib_processors_minsev//:minsev",
122+
"@io_opentelemetry_go_otel//:otel",
123+
"@io_opentelemetry_go_otel//attribute",
124+
"@io_opentelemetry_go_otel//semconv/v1.21.0:v1_21_0",
125+
"@io_opentelemetry_go_otel_exporters_otlp_otlplog_otlploghttp//:otlploghttp",
126+
"@io_opentelemetry_go_otel_exporters_otlp_otlpmetric_otlpmetrichttp//:otlpmetrichttp",
127+
"@io_opentelemetry_go_otel_exporters_otlp_otlptrace_otlptracehttp//:otlptracehttp",
128+
"@io_opentelemetry_go_otel_exporters_prometheus//:prometheus",
129+
"@io_opentelemetry_go_otel//codes",
130+
"@io_opentelemetry_go_otel_metric//:metric",
131+
"@io_opentelemetry_go_otel_sdk//resource",
132+
"@io_opentelemetry_go_otel_sdk//trace",
133+
"@io_opentelemetry_go_otel_sdk_log//:log",
134+
"@io_opentelemetry_go_otel_sdk_metric//:metric",
135+
"@io_opentelemetry_go_otel_trace//:trace",
99136
],
100137
)

MODULE.bazel

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ module(
55
version = "0.0.1",
66
)
77

8-
bazel_dep(name = "rules_go", version = "0.50.1", repo_name = "rules_go")
9-
bazel_dep(name = "gazelle", version = "0.38.0", repo_name = "gazelle")
8+
bazel_dep(name = "gazelle", version = "0.42.0", repo_name = "gazelle")
9+
bazel_dep(name = "platforms", version = "0.0.10")
10+
bazel_dep(name = "rules_go", version = "0.53.0", repo_name = "rules_go")
1011
bazel_dep(name = "rules_pkg", version = "1.0.1")
1112

1213
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
13-
go_sdk.download(version = "1.23.2")
14+
go_sdk.download(version = "1.24.2")
1415

1516
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
1617
go_deps.from_file(go_mod = "//:go.mod")
@@ -24,4 +25,20 @@ use_repo(
2425
"com_github_yuin_goldmark",
2526
"com_github_yuin_goldmark_emoji",
2627
"com_tailscale",
28+
"io_opentelemetry_go_contrib_bridges_otelslog",
29+
"io_opentelemetry_go_contrib_processors_minsev",
30+
"io_opentelemetry_go_otel",
31+
"io_opentelemetry_go_otel_exporters_otlp_otlplog_otlploghttp",
32+
"io_opentelemetry_go_otel_exporters_otlp_otlpmetric_otlpmetrichttp",
33+
"io_opentelemetry_go_otel_exporters_otlp_otlptrace_otlptracehttp",
34+
"io_opentelemetry_go_otel_exporters_prometheus",
35+
"io_opentelemetry_go_otel_metric",
36+
"io_opentelemetry_go_otel_sdk",
37+
"io_opentelemetry_go_otel_sdk_log",
38+
"io_opentelemetry_go_otel_sdk_metric",
39+
"io_opentelemetry_go_otel_trace",
2740
)
41+
42+
# rpm = use_extension("@rules_pkg//pkg:extensions/rpm.bzl", "rpm")
43+
# rpm.toolchain()
44+
# use_repo(rpm, "rpm_tool")

0 commit comments

Comments
 (0)