A website for my game dev stuff that supports chat, etc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
Zed A. Shaw 01fcb964be Created a basic set of tools for making my sites. 2 weeks ago
admin Removed blockstart and replicated it in tailwind's thing. 4 weeks ago
api All the pages are working again, but Alpine is insanely frustrating. 1 month ago
common Started the insert page but need to take a break to do the final part. 1 month ago
config Small config and my own little lib. 2 months ago
data All the pages are working again, but Alpine is insanely frustrating. 1 month ago
migrations All the pages are working again, but Alpine is insanely frustrating. 1 month ago
pages Created a basic set of tools for making my sites. 2 weeks ago
scratchpad More testing of the sqlx and squirrel database system, then added in goose for migrations. Pretty close to making a first version api. 3 months ago
static Created a basic set of tools for making my sites. 2 weeks ago
tests All the pages are working again, but Alpine is insanely frustrating. 1 month ago
tools/cmd/bot Started the tailwind conversion process. 4 weeks ago
views Figured out that SVG is hot garbage and got an icon to work for the home icon. 3 weeks ago
.air.toml Move to port 600* so that I don't conflict with my other projects. 3 weeks ago
.gitignore Started the tailwind conversion process. 4 weeks ago
LICENSE Initial commit 3 months ago
Makefile Created a basic set of tools for making my sites. 2 weeks ago
NOTES.md Start bringing in Helix for a twitch bot and have notes on how to use the twitch-cli tool. 1 month ago
README.md Sorted out how to do views with Go html/template, how to put code in subdirectories for a namespace, and documented why Go's modules are so weird. 3 months ago
config_example.toml Example config file. 2 months ago
go.mod Upgraded to a new ssgod to fix a few things and removed old css. 3 weeks ago
go.sum Upgraded to a new ssgod to fix a few things and removed old css. 3 weeks ago
main.go Started using my super-saiyan-god tool but I need to rework the repo so it supports the tool style for go get. 1 month ago
setup.sql Have a mostly working API server in go that's talking to streams/index.html and related pages. 3 months ago
ssgod.toml Bringing in icons to use and the theme turned into gray only. 4 weeks ago
ssgod_copy.toml Wrong directory target. 3 weeks ago

README.md

zedshaw.games

This is a learning projects for me to learn Go. It's a simple website that serves past stream information, a place to post links during stream, and the games I've made while live streaming.

Getting godoc To Work

There's a built-in command go doc but there's also a more advanced tool by Google called godoc. I know, amazing naming. Anyway, to get it you do this:

go get --tool go.googlesource.com/tools/godoc@latest

You can then run it and start indexing everything you've installed and also yourprojects packages, plus get a nice web browser based search page to view the docs:

go tool godoc -http=localhost:6060 -index

NOTE: Google doesn't know how the internet works so you have to use localhost:PORT and not 127.0.0.1:PORT when you run this.

After that it'll take some time to index everything but you can already start browsing the APIs you need, and your project's stuff is in the Third Party section.

Dealing With Module Bullshit

The way to think about Go's modules is that they don't have modules, they have "projects." Every directory's .go files export all of their functions without any namespacing based on the file's name. So if you put FooBar into tools.go and Dipshit in fuckyou.go then your namespace for all files has raw dogged FooBar and Dipshit without any reference to tools or fuckyou.

That's because your root directory is a whole project, not a module. To then create a namespace you have to make a directory, place the files in that directory, and add package mymod at the top of those files. You then have to import this as if it's an entire fucking project everywhere you want to use it:

import 'mywholewebsite.com/rootproject/subproject'

In this case you have a directory subproject and in there are a bunch of .go files with package subproject at the top to indicate they are in that subproject. Thinking about Go's modules as separate projects helps to sort out this import statement.

  1. mkdir tools
  2. Create files in tools/ with package tools
  3. import "zedshaw.games/webapp/tools" to get the subdirectory

Why Did Go Do This?

That's because it comes from Google, and Google is famous for two things:

  1. Using a monorepo.
  2. Assuming everyone else uses a monorepo.

Don't believe me? Go look at the official first document covering modules and you'll see they create two totally separate projects at the root which then link to each other. That's not how anyone else thinks when they make a single project to work on, but if you're suffering in monorepo hell you'll do it this way.

I'll also posit that Google has some weird incentive that measures numbers of projects in the monorepo as some kind of metric for employee productivity, so everyone working there is motivated to get as many little projects into the monorepo as possible, thus a great way to get them to adopt Go is to make Go support pulling tons of random projects from the root of a monorepo.

So that's why you have to put your whole entire domain name into the import, and why you have all the functions just raw dogged into your face when you make multiple files, and why subdirectories are treated like whole little projects.