a little refactoring to support gocheck