-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
I had an idea of having discuss that could be used outside of tdiscuss, for a service with a different authn/z mechanism. It's a bit far fetched and at this point only impedes progress. Bazel works again, so I added more targets for {linux,darwin} and {amd64,arm64}. Signed-off-by: Ian Meyer <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,51 @@ | ||
load("@gazelle//:def.bzl", "gazelle") | ||
load("@rules_go//go:def.bzl", "go_library") | ||
load("helper.bzl", "cross_compile_binary") | ||
load("platforms.def.bzl", "PLATFORMS") | ||
|
||
# gazelle:prefix github.com/imeyer/tdiscuss | ||
gazelle(name = "gazelle") | ||
|
||
# Name of the binary | ||
NAME = "tdiscuss" | ||
|
||
go_library( | ||
name = "{}_lib".format(NAME), | ||
srcs = [ | ||
"config.go", | ||
"db.go", | ||
"main.go", | ||
"member.go", | ||
"metrics.go", | ||
"models.go", | ||
"queries.sql.go", | ||
"server.go", | ||
"thread.go", | ||
], | ||
embedsrcs = [ | ||
"tmpl/error.html", | ||
"tmpl/footer.html", | ||
"tmpl/header.html", | ||
"tmpl/index.html", | ||
"tmpl/newthread.html", | ||
"tmpl/thread.html", | ||
], | ||
importpath = "github.com/imeyer/{}".format(NAME), | ||
visibility = ["//visibility:private"], | ||
deps = [ | ||
"@com_github_jackc_pgx_v5//:pgx", | ||
"@com_github_jackc_pgx_v5//pgconn", | ||
"@com_github_jackc_pgx_v5//pgtype", | ||
"@com_github_jackc_pgx_v5//pgxpool", | ||
"@com_github_prometheus_client_golang//prometheus", | ||
"@com_github_prometheus_client_golang//prometheus/promhttp", | ||
"@com_tailscale//client/tailscale", | ||
"@com_tailscale//hostinfo", | ||
"@com_tailscale//tsnet", | ||
], | ||
) | ||
|
||
[cross_compile_binary( | ||
name = NAME, | ||
goarch = goarch, | ||
goos = goos, | ||
) for (goos, goarch) in PLATFORMS] |
Large diffs are not rendered by default.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package discuss | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Helper module to create binaries per PLATFORM-ARCH combination""" | ||
|
||
load("@rules_go//go:def.bzl", "go_binary") | ||
|
||
# Function to create a go_binary target for each platform-arch combination | ||
def cross_compile_binary(name, goos, goarch): | ||
go_binary( | ||
name = "{}-{}-{}".format(name, goos, goarch), | ||
embed = [":{}_lib".format(name)], | ||
goarch = goarch, | ||
goos = goos, | ||
visibility = ["//visibility:public"], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package discuss | ||
package main | ||
|
||
import ( | ||
"log/slog" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package discuss | ||
package main | ||
|
||
import ( | ||
"net/http" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"""Define platform, arch pairs to build""" | ||
|
||
# Define the matrix of platforms and architectures | ||
PLATFORMS = [ | ||
("linux", "amd64"), | ||
("linux", "arm64"), | ||
("darwin", "amd64"), | ||
("darwin", "arm64"), | ||
] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package discuss | ||
package main | ||
|
||
import ( | ||
"html/template" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package discuss | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|