Also my smart contract code and the way I read the values is as follows.
// read global state
byte "counter"
dup
app_global_get
// increment the value
int 1
+
// store to scratch space
dup
store 0
// update global state
app_global_put
// load return value as approval
load 0
return
func readGlobalState(client *algod.Client, account crypto.Account, index uint64) {
accountInfo, err := client.AccountInformation(account.Address.String()).Do(context.Background())
if err != nil {
fmt.Printf("Error getting account info: %s\n", err)
return
}
for _, ap := range accountInfo.CreatedApps {
if ap.Id == index {
fmt.Printf("Global state for app-id %d:\n", ap.Id)
fmt.Println(ap.Params.GlobalState)
}
}
}