<commit_before>package main

import (
	"flag"
	"github.com/Terry-Mao/goconf"
	"strconv"
)

var (
	gconf    *goconf.Config
	Conf     *Config
	confFile string
)

func init() {
	flag.StringVar(&confFile, "c", "./push-job.conf", " set config file path")
}

type Config struct {
	Log               string            `goconf:"base:log"`
	RouterAddrs       []string          `goconf:"router:addr:,"`
	ZKAddrs           []string          `goconf:"kafka:zookeeper.list:,"`
	ZKRoot            string            `goconf:"kafka:zkroot"`
	KafkaTopic        string            `goconf:"kafka:topic"`
	Comets            map[int32]string  `goconf:"-"`
	RouterRPCNetworks []string          `goconf:"router:networks:,"`
	PushChan          int               `goconf:"push:chan"`
	PushChanSize      int               `goconf:"push:chan.size"`
	RouterRPCAddrs    map[string]string `-`
}

func NewConfig() *Config {
	return &Config{
		Comets:         make(map[int32]string),
		ZKRoot:         "",
		KafkaTopic:     "kafka_topic_push",
		RouterRPCAddrs: make(map[string]string),
		PushChan:       4,
		PushChanSize:   100,
	}
}

// InitConfig init the global config.
func InitConfig() (err error) {
	Conf = NewConfig()
	gconf = goconf.New()
	if err = gconf.Parse(confFile); err != nil {
		return err
	}
	if err = gconf.Unmarshal(Conf); err != nil {
		return err
	}
	var serverIDi int64
	for _, serverID := range gconf.Get("comets").Keys() {
		addr, err := gconf.Get("comets").String(serverID)
		if err != nil {
			return err
		}
		serverIDi, err = strconv.ParseInt(serverID, 10, 32)
		if err != nil {
			return err
		}

		Conf.Comets[int32(serverIDi)] = addr
	}
	return
}<commit_msg>remove no used config key<commit_after>package main

import (
	"flag"
	"github.com/Terry-Mao/goconf"
	"strconv"
)

var (
	gconf    *goconf.Config
	Conf     *Config
	confFile string
)

func init() {
	flag.StringVar(&confFile, "c", "./push-job.conf", " set config file path")
}

type Config struct {
	Log          string           `goconf:"base:log"`
	ZKAddrs      []string         `goconf:"kafka:zookeeper.list:,"`
	ZKRoot       string           `goconf:"kafka:zkroot"`
	KafkaTopic   string           `goconf:"kafka:topic"`
	Comets       map[int32]string `goconf:"-"`
	PushChan     int              `goconf:"push:chan"`
	PushChanSize int              `goconf:"push:chan.size"`
}

func NewConfig() *Config {
	return &Config{
		Comets:       make(map[int32]string),
		ZKRoot:       "",
		KafkaTopic:   "kafka_topic_push",
		PushChan:     4,
		PushChanSize: 100,
	}
}

// InitConfig init the global config.
func InitConfig() (err error) {
	Conf = NewConfig()
	gconf = goconf.New()
	if err = gconf.Parse(confFile); err != nil {
		return err
	}
	if err = gconf.Unmarshal(Conf); err != nil {
		return err
	}
	var serverIDi int64
	for _, serverID := range gconf.Get("comets").Keys() {
		addr, err := gconf.Get("comets").String(serverID)
		if err != nil {
			return err
		}
		serverIDi, err = strconv.ParseInt(serverID, 10, 32)
		if err != nil {
			return err
		}

		Conf.Comets[int32(serverIDi)] = addr
	}
	return
}
{'fraction_non_alphanumeric': 0.13926940639269406, 'fraction_numerical': 0.010437051532941943, 'mean_word_length': 2.68187274909964, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5131446', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1125, 'n_words': 244}