- ]d
- Go to the next diagnostic (e.g., an error or warning).
- [d
- Go to the previous diagnostic.
- <leader>cr
- Rename the symbol under the cursor (e.g., a function or variable).
Note: The default <leader> key in LazyVim is the Space key.
Note: The default <leader> key in LazyVim is the Space key.
| package main | |
| import ( | |
| "log/slog" | |
| "net" | |
| "net/http" | |
| "sync" | |
| "github.com/golang/groupcache/lru" | |
| "golang.org/x/time/rate" |
| -- Create a table named 'users' with an 'email' column. | |
| -- The 'email' column is set to be UNIQUE and uses NOCASE collation, | |
| -- which means case will be ignored for uniqueness checks. | |
| CREATE TABLE users(email TEXT UNIQUE COLLATE NOCASE); | |
| -- Insert an email address. The case will be preserved as entered. | |
| INSERT INTO users(email) VALUES("[email protected]"); | |
| -- Retrieve the email from the 'users' table. | |
| -- The email is stored exactly as entered, preserving its original case. |
| type dualFS struct { | |
| primary fs.FS | |
| secondary fs.FS | |
| } | |
| var ( | |
| _ fs.FS = &dualFS{} | |
| _ fs.ReadDirFS = &dualFS{} | |
| _ fs.ReadFileFS = &dualFS{} | |
| _ fs.StatFS = &dualFS{} |
Here’s a straightforward guide to automatically format Go HTML templates (*.html files) in Neovim using the LazyVim distribution and Prettier.
First, ensure you have LazyVim installed. Then, you need to enable the built-in Go language extras.
| package main | |
| import ( | |
| "crypto/rand" | |
| "github.com/google/uuid" | |
| ) | |
| // NewSafeUUID creates a cryptographically safe UUID. | |
| // |
| type CustomDatetime time.Time | |
| func (d *CusotmDatetime) UnmarshalJSON(b []byte) error { | |
| var s string | |
| if err := json.Unmarshal(b, &s); err != nil { | |
| return err | |
| } | |
| t, err := time.Parse(time.RFC3339, s) | |
| if err != nil { | |
| t, err = time.ParseInLocation("2006-01-02T15:04:05", s, newNewYorkOnce()) |
| package main | |
| import ( | |
| "database/sql" | |
| "fmt" | |
| "strings" | |
| "github.com/mattn/go-sqlite3" | |
| ) |
| package main | |
| import ( | |
| "fmt" | |
| "strings" | |
| ) | |
| func main() { | |
| // https://cloud.google.com/text-to-speech/docs/ssml#support-for-ssml-elements | |
| // https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API/Web_Video_Text_Tracks_Format#cue_payload |