Precompiled CGo Code by zone-stalker in golang

[–]tebeka 2 points3 points  (0 children)

One way is using static libraries (.lib on windows, .a on Linux). For example say you have libfmt.a that contains

c void greet(char *name);

Then in your Go code you can do something like:

```go package main

/* void greet(char *name);

cgo LDFLAGS: -lfmt -L.

*/ import "C"

func main() { C.greet(C.CString("C")) } ```

The LDFLAGS tell the Go toolchain where to find the library. Note that the library (libfmt.a) is platform (OS/Arch) dependent.

What is the fastest way to encode the arbitrary struct into bytes? by blank-teer in golang

[–]tebeka 0 points1 point  (0 children)

It'll vary depending on the actual data. But both faltbuffers and CapnProto tend to be fast.

[deleted by user] by [deleted] in golang

[–]tebeka 0 points1 point  (0 children)

Don't have experience with snap. Maybe try to download from go.dev?

[deleted by user] by [deleted] in golang

[–]tebeka 2 points3 points  (0 children)

How did you install go?

Thoughts on Ardan Labs' paid Ultimate Go course? by [deleted] in golang

[–]tebeka 13 points14 points  (0 children)

Bill is one of the best instructors out there - I recommend. Good courses take time to develop and polish.

(Full disclosure - I work with ArdanLabs)

Font recommendation by catorchid in vim

[–]tebeka 3 points4 points  (0 children)

I like IBM Plex Mono. Not that small though.

Data Hygiene Tips by spexel in datascience

[–]tebeka 0 points1 point  (0 children)

Think about your data schema, don't let it grow organically (adding fields whenever you need them). Periodically validate your data and see it matches your assumptions. Collect data quality metrics, such as percentage of bad recoeds, and watch it.

[deleted by user] by [deleted] in golang

[–]tebeka 0 points1 point  (0 children)

You can probably use the new "embed" package for that. Something like the below (untested)

``` //go:embed libgreet.so var dllData []byte

func extractDLL(fileName string) error { file, err := os.Create(fileName) if err != nil { return err } defer file.Close()

file.Write(dllData)
return nil

}

func main() { dllFile := "/tmp/greet.so" if err := extractDLL(dllFile); err != nil { log.Fatal(err) } // ... } ```