I understand Rust being type safe, but Im seeing syntax that Ive never seen in my life in Go which looks too messy

var test int < bruh what?

:=

func(u User) hi () { … } Where is the return type and why calling this fct doesnt require passing the u parameter but rather u.hi().

map := map[string] int {} < wtf

  • 0x00@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    17 days ago

    My least favorite part of Go, by far, is the capitalization as struct member visibility thing. That and the not super great json encoding annotations.

    Here’s a sample:

    type Change struct {
    	Path             string `json:"path"`
    	Category         string `json:"category"` // change, append, create, delete
    	Position         int64  `json:"position"`
    	Size             int64  `json:"size"`
    	OriginalChecksum string `json:"original_checksum"`
    	UpdatedChecksum  string `json:"updated_checksum"`
    	UnixTimestamp    int64  `json:"unix_timestamp"`
    	Data             []byte `json:"data"`
    	MatchedRules     []Rule `json:"matched_rules"`
    }
    

    I would take explicit public declarators any day