metaprogramming-go

(★ 109)

Example project for an article Metaprogramming with Go

File Explorer

  • go.mod
  • go.sum
  • LICENSE
  • README.md

# Use via CDN

jsDelivr

jsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.

Command Glossary

Commands referenced in this DOCs, explained below.

🔍

interface

View Details ▼

Manage interfaces.
Accessed in configuration mode.

interface vlan {{1}}

Configure a VLAN:

{{no shutdown|shutdown}}

Set an interface to be active or inactive (this is run inside the interface command):

🔍

fmt

View Details ▼

Reformat a text file by joining its paragraphs and limiting the line width to a number of characters (75 by default).

fmt {{path/to/file}}

Reformat a file:

fmt {{[-w|--width]}} {{n}} {{path/to/file}}

Reformat a file producing output lines of (at most) `n` characters:

fmt {{[-s|--split-only]}} {{path/to/file}}

Reformat a file without joining lines shorter than the given width together:

🔍

go generate

View Details ▼

Generate Go files by running commands within source files.

go generate

Generate Go files by running commands within source files:

🔍

go run

View Details ▼

Compile and run Go code without saving a binary.

go run {{path/to/file.go}}

Run a Go file:

go run {{path/to/package}}

Run a main Go package:

🔍

strings

View Details ▼

Find printable strings in an object file or binary.

strings {{path/to/file}}

Print all strings in a binary:

strings {{[-n|--bytes]}} {{n}} {{path/to/file}}

Limit results to strings at least n characters long:

strings {{[-t|--radix]}} d {{path/to/file}}

Prefix each result with its offset within the file:

// repository documentation