K
K
Kagtaviy2017-02-18 02:19:53
go
Kagtaviy, 2017-02-18 02:19:53

How to write the correct task in gulp for go?

Hello, where can I find an example or information showing how to compile a go application using gulp?
The goal is this. We track changes in .go files (gulp-watch) - if there is a change, then we execute the go build main.go command.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kagtaviy, 2017-02-18
@Kagtaviy

gulp.task('go:build', function() {
    var build = child.spawnSync('go', ['build', 'main.go']);
    if (build.stderr.length) {
        var lines = build.stderr.toString()
            .split('\n').filter(function(line) {
                return line.length
            });
        for (var l in lines)
            util.log(util.colors.red(
                'Error (go build): ' + lines[l]
            ));
        notifier.notify({
            title: 'Error (go build)',
            message: lines
        });
    }
    return build;
});

V
Vitaly Filinkov, 2017-02-18
@vitfil

Check out how it's done by beego

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question