Golang doc func parameters

There is no explicit documentation of function parameters in godoc. Any necessary details not covered by the name and type of the parameter should go into the doc comment for the function. For examples, see every function in the standard library.

How to pass type to function argument in Go

You can’t. You can only pass a value, and CustomStruct is not a value but a type. Using a type identifier is a compile-time error. Usually when a “type” is to be passed, you pass a reflect.Type value which describes the type. This is what you “create” inside your getTypeName(), but then the getTypeName() will … Read more

Use of internal package not allowed

Internal packages (packages that are inside a folder that has an internal folder in their path) can only be imported from packages rooted at the parent of the internal folder. E.g. a package pkg/foo/internal/bar can be imported by the package pkg/foo/internal/baz and also from pkg/foo/baz, but cannot be imported by the package pkg nor can … Read more

Create array of array literal in Golang

You almost have the right thing however your syntax for the inner arrays is slightly off, needing curly braces like; test := [][]int{[]int{1,2,3},[]int{1,2,3}} or a slightly more concise version; test := [][]int{{1,2,3},{1,2,3}} The expression is called a ‘composite literal’ and you can read more about them here; https://golang.org/ref/spec#Composite_literals But as a basic rule of thumb, … Read more