Skip to content

Commit

Permalink
Format all go files
Browse files Browse the repository at this point in the history
  • Loading branch information
jmattheis committed Jan 1, 2019
1 parent 2a0e84c commit 68b1609
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 48 deletions.
10 changes: 4 additions & 6 deletions api/application_test.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
package api

import (
"math/rand"
"net/http/httptest"
"testing"

"strings"

"bytes"
"errors"
"io"
"io/ioutil"
"math/rand"
"mime/multipart"
"net/http/httptest"
"os"
"strings"
"testing"

"github.com/gin-gonic/gin"
"github.com/gotify/server/mode"
Expand Down
6 changes: 2 additions & 4 deletions api/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package api
import (
"math/rand"
"net/http/httptest"
"testing"

"strings"

"net/url"
"strings"
"testing"

"github.com/gin-gonic/gin"
"github.com/gotify/server/mode"
Expand Down
3 changes: 1 addition & 2 deletions api/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ package api

import (
"errors"
"strconv"
"strings"
"time"

"strconv"

"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/gotify/location"
Expand Down
9 changes: 3 additions & 6 deletions api/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@ package api

import (
"net/http/httptest"
"net/url"
"strings"
"testing"
"time"

"github.com/gin-gonic/gin"
"github.com/gotify/server/auth"
"github.com/gotify/server/mode"
"github.com/gotify/server/model"
"github.com/gotify/server/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"

"strings"

"net/url"

"github.com/gotify/server/auth"
)

func TestMessageSuite(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions api/stream/once.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
package stream

import (
"sync/atomic"
"sync"
"sync/atomic"
)

// Modified version of sync.Once (https://github.com/golang/go/blob/master/src/sync/once.go)
Expand All @@ -25,12 +25,12 @@ func (o *once) Do(f func()) {
}
}

func (o *once) mayExecute() bool {
func (o *once) mayExecute() bool {
o.m.Lock()
defer o.m.Unlock()
if o.done == 0 {
atomic.StoreUint32(&o.done, 1)
return true
}
return false
}
}
5 changes: 2 additions & 3 deletions api/stream/stream.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package stream

import (
"net/http"
"net/url"
"regexp"
"sync"
"time"

"net/http"
"net/url"

"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
"github.com/gotify/server/auth"
Expand Down
3 changes: 1 addition & 2 deletions api/stream/stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ package stream
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"

"errors"

"github.com/fortytw2/leaktest"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
Expand Down
6 changes: 2 additions & 4 deletions app.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package main

import (
"math/rand"
"time"

"fmt"

"math/rand"
"os"
"time"

"github.com/gotify/server/config"
"github.com/gotify/server/database"
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Configuration struct {
// Get returns the configuration extracted from env variables or config file.
func Get() *Configuration {
conf := new(Configuration)
err := configor.New(&configor.Config{EnvironmentPrefix: "GOTIFY"}).Load(conf, "config.yml", "/etc/gotify/config.yml")
err := configor.New(&configor.Config{EnvironmentPrefix: "GOTIFY"}).Load(conf, "config.yml", "/etc/gotify/config.yml")
if err != nil {
panic(err)
}
Expand Down
3 changes: 1 addition & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package config

import (
"os"
"testing"

"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
)
Expand Down
3 changes: 2 additions & 1 deletion docs/swagger.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package docs

import (
"strings"

"github.com/gin-gonic/gin"
"github.com/gobuffalo/packr"
"strings"
)

// Serve serves the documentation.
Expand Down
4 changes: 1 addition & 3 deletions error/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ package error

import (
"fmt"

"github.com/gin-gonic/gin"

"net/http"
"strings"
"unicode"

"github.com/gin-gonic/gin"
"github.com/gotify/server/model"
"gopkg.in/go-playground/validator.v8"
)
Expand Down
16 changes: 7 additions & 9 deletions router/router.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
package router

import (
"net/http"
"time"

"github.com/gin-gonic/gin"
"github.com/gotify/server/api"
"github.com/gotify/server/auth"
"github.com/gotify/server/database"
"github.com/gotify/server/error"
"github.com/gotify/server/ui"
"github.com/jmattheis/go-packr-swagger-ui"

"net/http"

"github.com/gotify/location"
"github.com/gotify/server/api"
"github.com/gotify/server/api/stream"
"github.com/gotify/server/auth"
"github.com/gotify/server/config"
"github.com/gotify/server/database"
"github.com/gotify/server/docs"
"github.com/gotify/server/error"
"github.com/gotify/server/mode"
"github.com/gotify/server/model"
"github.com/gotify/server/ui"
"github.com/jmattheis/go-packr-swagger-ui"
)

// Create creates the gin engine with all routes.
Expand Down
3 changes: 1 addition & 2 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package runner
import (
"crypto/tls"
"fmt"
"log"
"net"
"net/http"

"log"

"github.com/gin-gonic/gin"
"github.com/gotify/server/config"
"golang.org/x/crypto/acme/autocert"
Expand Down

0 comments on commit 68b1609

Please sign in to comment.