chore: cleanup — untrack binaries, consolidate Go dirs, dedupe tools
- Untrack and delete compiled binaries (tarsum, gosoft.exe, rust uniq/uniq2);
ignore build outputs (dist/, bin/, *.exe, *.test, .ruff_cache/)
- Merge tools/go/ and projects/go-tools/go/ into projects/go-tools/<name>/
- Fix goipgrep .gitignore: bare 'ipgrep' pattern was ignoring cmd/ipgrep/,
so the main entrypoint was never tracked; now anchored to /ipgrep
- Archive duplicate implementations to archive/experimental/{rust,go}/
(uniq, between, tarsum rewrites); canonical versions stay in tools/
- Update README tool catalog to match new layout
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
module git.ktf.ninja/tabledevil/goinfo
|
||||
|
||||
go 1.22.5
|
||||
@@ -0,0 +1,52 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"os/user"
|
||||
)
|
||||
|
||||
func getHostname() string {
|
||||
hostname, err := os.Hostname()
|
||||
if err != nil {
|
||||
log.Println("Could not retrieve Hostname")
|
||||
return ""
|
||||
} else {
|
||||
return hostname
|
||||
}
|
||||
}
|
||||
|
||||
func getUsernameDomain() string {
|
||||
user, err := user.Current()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return user.Username
|
||||
}
|
||||
|
||||
func getIP(hostname string) string {
|
||||
addrs, err := net.LookupIP(hostname)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return addrs[0].String()
|
||||
}
|
||||
|
||||
func getGroups() []int {
|
||||
groups, err := os.Getgroups()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return groups
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Println("hostname: ", getHostname())
|
||||
fmt.Println("username: ", getUsernameDomain())
|
||||
fmt.Println("groups: ", getGroups())
|
||||
fmt.Println("google: ", getIP("www.google.de"))
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user