If I have a function which takes a reference as an argument and I want to use that function to initialize a variable I need to do this inside the init() function. That solution works, but it smells not really correct to me.

Is there another way to initialize a variable for a package in go like to use the init() function?

I think that there must be a better way. I thought already about a wrapping function, but that makes the logik not better.

I prepared a short and simple example package main

import (
    "fmt"
)

var a string
//A use of a function is not allowed
//make(&a)


//Need to call init
func init() {
    make(&a)
}

func main() {
    fmt.Println(a)
}

func make(b *string) {
    *b = "abc"
}