stretchr: testify…
… is used in many projects, minimal for assertions, but also it is really useful for mocks and testsuites
https://github.com/stretchr/testify
Even when the README contains all information, this is my one-pager to quickstart start a new testfile
type ToTestTestSuite struct {
suite.Suite
}
func (s *ToTestTestSuite) SetupTest() {}
func (s *ToTestTestSuite) AfterTest() {}
func (s *ToTestTestSuite) BeforeTest(suiteName, testName string) {}
func (s *ToTestTestSuite) TearDownTest() {}
type DependencyMock struct {
mock.Mock
}
func (a *DependencyMock) MockedFunc(someArgs string) (string, error) {
args := a.Called(someArgs)
return args.String(0), args.Error(1)
}
func (s *ToTestTestSuite) TestAllTheThings() {
depMock := new(DependencyMock)
depMock.On("MockedFunc", "much hard").Return("have a break", nil)
depMock.On("MockedFunc", mock.Anything).Return("", errors.New("too hard"))
service := &Service{
Dependency: depMock,
}
result, err := service.DoHardWork("much hard")
require.Nil(s.T(), err)
require.Equal(s.T(), "have a break", result)
depMock.AssertExpectations(s.T())
}
func TestToTestTestSuite(t *testing.T) {
suite.Run(t, new(ToTestTestSuite))
}
...
Update: i also found the dependency list on the ebiten wiki: https://github.com/hajimehoshi/ebiten/wiki/Linux#fedora
Second: and it is now found on the new website https://ebiten.org/install.html#Fedora
a few weeks after i ported Impact.js to the modern world (some writing about this adventure will follow), i found another interesting engine, this time written in go.
the engine is called ebiten and has a pretty low-level api, but compiles to all desktop and mobile platforms - so i want to give it a try
...
Picking up go is a lot of fun! So does a few of my colleagues :-)
Tobi M. (“the destroyer”) asked if i have a solution to run a golang docker image with the go-sqlite3 driver
I remembered to had the same problem, so after my post about really small docker images, lets add a few more bytes!
the solution
This solution is not my own, i found and tried other solutions but stayed with this Dockerfile on github
...
building docker images with go should be super easy - picking a minimal image (in my case I build from alpine), build the binary, ADD
to the image, run…
the problem
your app is not starting, instead you see something like this
standard_init_linux.go:195: exec user process caused "no such file or directory"
cause: several modules are calling C code via cgo, and cgo depends on libc. Go found libc on the system it was build on, so it linked to it. But libc is missing on alpine…
...
This is a small online tool where you can “upload” multiple gifs to concatinate all gifs to one (no drag & drop, just select one after another).
The cool thing: nothing is uploaded to a server, everything is handled right in your browser! If you want to have a look in the network debugger: all requests are intercepted and answered “from ServiceWorker”
...