func SaveGopmfile(gf *goconfig.ConfigFile, fileName string) error {
	if err := goconfig.SaveConfigFile(gf, fileName); err != nil {
		return fmt.Errorf("Fail to save gopmfile: %v", err)
	}
	return nil
}
SaveGopmfile saves gopmfile to given path.
package setting
import (
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"strings"
	"github.com/gpmgo/gopm/modules/base"
	"github.com/gpmgo/gopm/modules/goconfig"
)
type Error struct {
	HasError bool
	Fatal    error
	Errors   []error
}
type Option struct {
}
const (
	VERSION     = 201602010
	VENDOR      = ".vendor"
	GOPMFILE    = ".gopmfile"
	PKGNAMELIST = "pkgname.list"
	VERINFO     = "data/VERSION.json"
)
const (
	URL_API_DOWNLOAD = "/api/v1/download"
	URL_API_REVISION = "/api/v1/revision"
)
var (
	HomeDir          string
	WorkDir          string  
	PkgNameListFile  string
	LocalNodesFile   string
	DefaultGopmfile  string
	DefaultVendor    string
	DefaultVendorSrc string
	InstallRepoPath  string  
	InstallGopath    string
	HttpProxy        string
	RegistryURL      string = "https://gopm.io"
	IsWindows        bool
	IsWindowsXP      bool
	HasGOPATHSetting bool
	Debug        bool
	LibraryMode  bool
	RuntimeError = new(Error)
	ConfigFile      string
	Cfg             *goconfig.ConfigFile
	PackageNameList = make(map[string]string)
	LocalNodes      *goconfig.ConfigFile
	RootPathPairs = map[string]int{
		"github.com":      3,
		"bitbucket.org":   3,
		"git.oschina.net": 3,
		"launchpad.net":   2,
		"golang.org":      3,
	}
	CommonRes = []string{"views", "templates", "static", "public", "conf"}
)
func LoadGopmfile(fileName string) (*goconfig.ConfigFile, error) {
	if !base.IsFile(fileName) {
		return goconfig.LoadFromData([]byte(""))
	}
	gf, err := goconfig.LoadConfigFile(fileName)
	if err != nil {
		return nil, fmt.Errorf("Fail to load gopmfile: %v", err)
	}
	return gf, nil
}