从函数返回数据

I am trying to return data from a function. In this example, I am looking up a bitcoin address on Blockchain.info, and what I would like to do is call the function, passing it the address, and return the final balance in a variable that I can use. Can someone show me what I am doing wrong?

package main

import (
  "fmt"
   "io/ioutil"
   "net/http"
    "os"
)

func getbalance(address string) {
  response, err := http.Get("https://blockchain.info/q/addressbalance/" + address)
  if err != nil {
      fmt.Printf("%s", err)
      os.Exit(1)
  } else {
      defer response.Body.Close()
      contents, err := ioutil.ReadAll(response.Body)
      if err != nil {
          fmt.Printf("%s", err)
          os.Exit(1)
      }
      fmt.Printf("%s
", string(contents))
      return string(contents)
  }
}


func main() {
  finalB := getbalance("1A63imbiQBtsnTqtUpuUT5WL2Ti7oKNLeg")
  fmt.Printf("Final Balance: %s", finalB)
}

Your function returns nothing:

func getbalance(address string) {
   ....
}

That function signature, return string:

func getbalance(address string) string {
  ...
}

I suggest you to learn basic Go functions