From 9a2edc5dd56af4eecb7feabcfad3b78ec9ff51d6 Mon Sep 17 00:00:00 2001 From: Morre Date: Wed, 19 Oct 2022 11:39:44 +0200 Subject: [PATCH] feat: open in browser after launching (#31) --- go.mod | 1 + go.sum | 2 ++ main.go | 3 +++ 3 files changed, 6 insertions(+) diff --git a/go.mod b/go.mod index 990dc7c..4340d81 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/envelope-zero/backend v1.8.0 github.com/gin-contrib/static v0.0.2-0.20220829131751-3035101e2445 github.com/rs/zerolog v1.28.0 + github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 ) require ( diff --git a/go.sum b/go.sum index a32b474..a2b6653 100644 --- a/go.sum +++ b/go.sum @@ -134,6 +134,8 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA= +github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/main.go b/main.go index f406762..5472707 100644 --- a/main.go +++ b/main.go @@ -16,6 +16,7 @@ import ( "github.com/envelope-zero/backend/pkg/router" "github.com/gin-contrib/static" "github.com/rs/zerolog/log" + "github.com/skratchdot/open-golang/open" ) // Embedding code taken from https://github.com/gin-contrib/static/issues/19#issue-830589998 @@ -78,6 +79,8 @@ func main() { Handler: r, } + _ = open.Run("http://localhost:3200") + // Wait for interrupt signal to gracefully shutdown the server with a timeout of 5 seconds. quit := make(chan os.Signal, 1) signal.Notify(quit, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)