-
-
Save drupol/e8db5a7e22611d3aa9cd94ca5acc4f6e to your computer and use it in GitHub Desktop.
Go in a Nix Shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
description = "A very basic flake"; | |
inputs = { | |
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | |
}; | |
outputs = { self, nixpkgs }: { | |
devShells.x86_64-linux.default = let | |
pkgs = nixpkgs.legacyPackages.x86_64-linux; | |
in pkgs.mkShell { | |
packages = [ | |
pkgs.go | |
]; | |
}; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module foo | |
go 1.22.2 | |
require github.com/go-chi/chi/v5 v5.0.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"log/slog" | |
"net/http" | |
"github.com/go-chi/chi/v5" | |
) | |
func main() { | |
router := chi.NewMux() | |
port := ":3000" | |
slog.Info("Application running on", "port", port) | |
log.Fatal(http.ListenAndServe(port, router)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment