diff --git a/.go/pkg/mod/cache/lock b/.go/pkg/mod/cache/lock new file mode 100644 index 0000000..e69de29 diff --git a/17-results-summary-component-go/.project b/17-results-summary-component-go/.project new file mode 100644 index 0000000..e69de29 diff --git a/17-results-summary-component-go/default.nix b/17-results-summary-component-go/default.nix new file mode 100644 index 0000000..9507f10 --- /dev/null +++ b/17-results-summary-component-go/default.nix @@ -0,0 +1,7 @@ +{ config, lib, pkgs, ... }: +let pname = "countries-page"; +in { + # todo, building app + # building docker image + # nixos module +} diff --git a/17-results-summary-component-go/go.mod b/17-results-summary-component-go/go.mod new file mode 100644 index 0000000..e5b1758 --- /dev/null +++ b/17-results-summary-component-go/go.mod @@ -0,0 +1,3 @@ +module sunshine.industries/results-summary-component-go + +go 1.20 diff --git a/17-results-summary-component-go/main.go b/17-results-summary-component-go/main.go new file mode 100644 index 0000000..c098df2 --- /dev/null +++ b/17-results-summary-component-go/main.go @@ -0,0 +1,23 @@ +package main + +import ( + "embed" + "io" + "log" + "net/http" +) + +//go:embed public +var publicContent embed.FS + +// starts webserver that serves html page for exercise +func main() { + // visible on http://localhost:8080/static/public/some-text.txt + http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(publicContent)))) + http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { + io.WriteString(w, "This is temporary here, hello") + }) + + log.Print("starting server on default :8080") + log.Fatal(http.ListenAndServe(":8080", nil)) +} diff --git a/17-results-summary-component-go/public/some-text.txt b/17-results-summary-component-go/public/some-text.txt new file mode 100644 index 0000000..4effa19 --- /dev/null +++ b/17-results-summary-component-go/public/some-text.txt @@ -0,0 +1 @@ +hello! diff --git a/flake.nix b/flake.nix index 92dcee1..ccb31b2 100644 --- a/flake.nix +++ b/flake.nix @@ -45,7 +45,16 @@ pkgs.nodePackages.tailwindcss pkgs.nodePackages.prettier pkgs.jdk + + pkgs.go + pkgs.wgo + pkgs.semgrep + pkgs.gopls ]; + shellHook = '' + export GOPATH=$PWD/.go + export PATH=$GOPATH/bin:$PATH + ''; }; packages.price-grid-app = price-grid.package; nixosModules.price-grid-app = price-grid.module;