From PHP to Go, here my first side project. What do you think?

197 views
Skip to first unread message

Matthieu Cneude

unread,
May 21, 2018, 11:29:26 AM5/21/18
to golang-nuts
Hello everybody,

I am a PHP developer for many years and I am trying to learn Golang. I think knowing a language which offer low level possibilities can be a very good complement to a more high level language.
Therefore I wrote a little application which watch tests file and run them here: https://github.com/Phantas0s/testomatic

What do you think about the code? About the application itself? How can I improve it?

Any advise is welcome. Even the worst criticism!

Thank you :)

matthe...@gmail.com

unread,
May 22, 2018, 5:59:26 PM5/22/18
to golang-nuts
Hello, here’s a code review. Thanks for sharing here.

These are my unfiltered opinions that may be wrong, and I hope they are useful for you.

Have you considered including an open source license like BSD? There’s a base GitHub license applied now.

func CreateRelative(
    path
string,
    confPath
string,
    scope
string,
) string {

could be

func CreateRelative(path, confPath, scope string) {

In package notifier the Notifier interface is unused. Directly writing in beeep.Alert and beeep.Notify is clearer than assuming the implementation might need to be varied in the future, and these symbols, if necessary, should be part of package main, having a separate package just to define an interface is unnecessary. If you need to vary the notification implementation later then add in the interface then. An interface definition should be an input in the same package.

Config is too general of a package name. These symbols should also be part of package main. This is another case where the interface is defined but not consumed.

Packages shouldn't be used for application structuring like you have with config. Packages should be made when portability between projects is possible or another package main is needed.

Often Go tools don’t have any text output unless there’s an error. Perhaps a flag could surround the watched files print?

This seems like it could be a useful part of a development workflow.

Matt

Matthieu Cneude

unread,
May 23, 2018, 3:05:39 PM5/23/18
to golang-nuts
This is really useful for me. Thanks a lot!
Reply all
Reply to author
Forward
0 new messages