Skip to content

Instantly share code, notes, and snippets.

@drupol

drupol/.envrc Secret

Created May 8, 2024 07:04
Show Gist options
  • Save drupol/e8db5a7e22611d3aa9cd94ca5acc4f6e to your computer and use it in GitHub Desktop.
Save drupol/e8db5a7e22611d3aa9cd94ca5acc4f6e to your computer and use it in GitHub Desktop.
Go in a Nix Shell
use flake
{
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
];
};
};
}
module foo
go 1.22.2
require github.com/go-chi/chi/v5 v5.0.12
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