Code Monkey home page Code Monkey logo

go-opstocat's People

Contributors

alindeman avatar calavera avatar rubyist avatar technoweenie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-opstocat's Issues

opstocat crashes when using non-string configuration values

I think string only is probably wise, since you could conceivably stick anything in there. Perhaps we can validate the type or catch the panic and show a useful error message.

Example code:

package main

import (
  "github.com/github/go-opstocat"
  "os"
)

type Configuration struct {
  TestVal int `json:"TEST_VAL"`
  *opstocat.Configuration
}

func (c *Configuration) OpstocatConfiguration() *opstocat.Configuration {
  return c.Configuration
}

func (c *Configuration) SetupLogger() {}

func main() {
  wd, err := os.Getwd()
  if err != nil {
    panic(err)
  }

  inner := opstocat.NewConfiguration(wd)
  inner.App = "test"
  c := &Configuration{
    Configuration: inner,
  }

  opstocat.ReadEnv(c)
  opstocat.SetupLogger(c)
}

Result:

rubyist:octotest scott$ TEST_VAL=100 ./octotest
panic: reflect: call of reflect.Value.SetString on int Value

goroutine 16 [running]:
runtime.panic(0x278ae0, 0xc208043880)
    /usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
reflect.flag.mustBe(0x26, 0x18)
    /usr/local/go/src/pkg/reflect/value.go:307 +0x8c
reflect.Value.SetString(0x21f3c0, 0xc208000ad0, 0x0, 0x26, 0x7fff5fbff12c, 0x3)
    /usr/local/go/src/pkg/reflect/value.go:1691 +0x3e
github.com/github/go-opstocat.readEnvConfig(0x2a1640, 0xc208000ad0)
    /Users/scott/src/gocode/src/github.com/github/go-opstocat/config.go:95 +0x2d6
github.com/github/go-opstocat.ReadEnv(0x5127b0, 0xc208000ad0)
    /Users/scott/src/gocode/src/github.com/github/go-opstocat/config.go:58 +0x67
main.main()
    /Users/scott/src/gocode/src/github.com/github/octotest/octotest.go:31 +0x10f

goroutine 19 [finalizer wait]:
runtime.park(0x14550, 0x466fd0, 0x465ac9)
    /usr/local/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x466fd0, 0x465ac9)
    /usr/local/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
    /usr/local/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1445

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.