Constructors
1 post tagged with "Constructors"
- Search Gear 14 - Pseudo Constructors!
Changed the config twitter caller to a pseudo constructor thus func NewTwitter(file string) (*twitter, error) { tw := new(twitter) var parser toml.Parser if _, err := ioutil.ReadFile(file); err != nil { tw.errors = errors.New(co.Lang("could not find the configuration file, you'll need to provide these setting for twitter to work")) } else { toml := parser.ParseFile(file) tw.userKey = toml.GetString("twitter.user-key") tw.userSecret = toml.GetString("twitter.user-secret") tw.apiKey = toml.GetString("twitter.api-key", "26276391-gtihvXIuNXzCD4HTOjx8630O8IPq19m810TxkLMmd") tw.apiSecret = toml.GetString("twitter.api-secret", "bYkulR93l70elsjZysjjDpxQT69RVF2GIUcjoMIkrADoc") tw.users, _ = toml.