code: func setupGlobalConfig() error {
  	// Multiple networks can't be selected simultaneously.
  	// Count number of network flags passed; assign active network params
  	// while we're at it
  	numNets := 0
  	if cfg.TestNet3 {
  		numNets++
  		activeNetParams = &chaincfg.TestNet3Params
  	}
  	if cfg.RegressionTest {
  		numNets++
  		activeNetParams = &chaincfg.RegressionNetParams
  	}
  	if cfg.SimNet {
  		numNets++
  		activeNetParams = &chaincfg.SimNetParams
  	}
  	if numNets > 1 {
  		return errors.New("The testnet, regtest, and simnet params " +
  			"can't be used together -- choose one of the three")
  	}
  
  	// Validate database type.
  	if !validDbType(cfg.DbType) {
  		str := "The specified database type [%v] is invalid -- " +
  			"supported types %v"
  		return fmt.Errorf(str, cfg.DbType, knownDbTypes)
  	}
  
  	// Append the network type to the data directory so it is "namespaced"
  	// per network.  In addition to the block database, there are other
  	// pieces of data that are saved to disk such as address manager state.
  	// All data is specific to a network, so namespacing the data directory
  	// means each individual piece of serialized data does not have to
  	// worry about changing names per network and such.
  	cfg.DataDir = filepath.Join(cfg.DataDir, netName(activeNetParams))
  
  	return nil
  }
docs: // setupGlobalConfig examine the global configuration options for any conditions
  // which are invalid as well as performs any addition setup necessary after the
  // initial parse.