Doubt help required

package main

import (

func main() {
fmt.Println(“Hello, playground”)
var data A
data.B.Value1 = “abc”


type A struct {
Hello string
B *struct {
Value1 string
Value2 string

throwing invalid pointer how can I overcome. B struct will be in A cant write outside A

You could make B not be a pointer:

You could also create a MakeA function:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.