Skip to content

refactor(website): stub out go website endpoints#5681

Open
michaelkedar wants to merge 5 commits into
google:masterfrom
michaelkedar:🕸️🚫🐍

Hidden character warning

The head ref may contain hidden characters: "\ud83d\udd78\ufe0f\ud83d\udeab\ud83d\udc0d"
Open

refactor(website): stub out go website endpoints#5681
michaelkedar wants to merge 5 commits into
google:masterfrom
michaelkedar:🕸️🚫🐍

Conversation

@michaelkedar

Copy link
Copy Markdown
Member

Set up all the endpoint stubs for the Go website migration.
Static files are to be //go:embeded into a filesystem, which should make the website speedier (though the binary bigger).
I haven't set up the datastore connections, nor dealt with rendering the Jinja templates in Go yet.

@michaelkedar michaelkedar requested a review from another-rex July 15, 2026 07:12
another-rex
another-rex previously approved these changes Jul 16, 2026

@another-rex another-rex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some minor comments

Comment thread go/cmd/website/main.go Outdated

var staticFS website.Config
if *staticDir != "" {
staticFS.StaticFS = os.DirFS(*staticDir)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm maybe use os.OpenRootFS? Another layer of protection against any path traversal stuff.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an embedded fs switch for prod.
This DirFS should only be used for local dev - I don't think path traversal is a big issue there.

Comment thread go/cmd/website/main.go Outdated
flag.Parse()

var staticFS website.Config
if *staticDir != "" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even need this check? I assume this should just not launch / panic if the flags are set to ""

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made this fail if no fs exists

Comment thread go/cmd/website/main.go Outdated
logger.ErrorContext(ctx, "Server error", slog.Any("error", err))
return err
case <-ctx.Done():
logger.InfoContext(ctx, "Shutting down website server...")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it fine to log with a ctx that's done?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is mostly okay (logging doesn't check if the context is done), but I've made this log on the shutdownCtx and used context.WithoutCancel there instead

Comment thread go/internal/website/server.go Outdated
Comment thread Makefile Outdated
@michaelkedar michaelkedar requested a review from another-rex July 16, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants