Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #16 from simplifi/cleanup
Browse files Browse the repository at this point in the history
Cleanup repo to conform to golang-standards
  • Loading branch information
cjonesy authored Mar 10, 2020
2 parents 6a6ac67 + 4f2a7a4 commit 6074130
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
build

# The binary itself
looking-glass
/looking-glass

# JetBrains
.idea
Expand Down
7 changes: 4 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ before:
- go mod tidy

builds:
- env:
- dir: ./cmd/looking-glass
env:
- CGO_ENABLED=0
flags:
- -v
ldflags:
- -X github.com/simplifi/looking-glass/version.Version={{.Version}}
- -X github.com/simplifi/looking-glass/version.Version={{.Version}}
goos:
- darwin
- linux
Expand All @@ -31,7 +32,7 @@ archives:
- none*

checksum:
name_template: 'checksums.txt'
name_template: "checksums.txt"

changelog:
skip: true
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ before_script:
- GO111MODULE=off go get -u golang.org/x/lint/golint

script:
- make ci
- make

# Calls goreleaser to build and push artifacts
deploy:
Expand Down
39 changes: 18 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
TAG?=""

# Clean up any cruft left over from old builds
.PHONY: clean
clean:
rm -rf looking-glass dist/

# Build a beta version of looking-glass
.PHONY: build
build: clean
CGO_ENABLED=0 go build
.DEFAULT_GOAL := test

# Run all tests
.PHONY: test
test: fmt lint vet test-unit

# Run a test release with goreleaser
.PHONY: test-release
test-release:
goreleaser --snapshot --skip-publish --rm-dist
test: fmt lint vet test-unit go-mod-tidy

# Run unit tests
.PHONY: test-unit
Expand All @@ -26,10 +13,9 @@ test-unit:

# Clean go.mod
.PHONY: go-mod-tidy
go-mod-tidy: build
go-mod-tidy:
go mod tidy
git diff HEAD
git diff --exit-code
git diff --exit-code go.sum

# Check formatting
.PHONY: fmt
Expand All @@ -46,9 +32,20 @@ lint:
vet:
go vet ./...

# For use in ci
.PHONY: ci
ci: build test go-mod-tidy
# Run a test release with goreleaser
.PHONY: test-release
test-release:
goreleaser --snapshot --skip-publish --rm-dist

# Clean up any cruft left over from old builds
.PHONY: clean
clean:
rm -rf looking-glass dist/

# Build a beta version of looking-glass
.PHONY: build
build: clean
CGO_ENABLED=0 go build ./cmd/looking-glass

# Create a git tag
.PHONY: tag
Expand Down
5 changes: 3 additions & 2 deletions cmd/root.go → cmd/looking-glass/cli/root.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cmd
package cli

import (
"fmt"
"github.com/spf13/cobra"
"os"

"github.com/spf13/cobra"
)

var (
Expand Down
9 changes: 5 additions & 4 deletions cmd/start.go → cmd/looking-glass/cli/start.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package cmd
package cli

import (
"github.com/simplifi/looking-glass/agent"
"github.com/simplifi/looking-glass/config"
"github.com/spf13/cobra"
"log"

"github.com/simplifi/looking-glass/pkg/looking-glass/agent"
"github.com/simplifi/looking-glass/pkg/looking-glass/config"
"github.com/spf13/cobra"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/version.go → cmd/looking-glass/cli/version.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package cmd
package cli

import (
"fmt"
"github.com/simplifi/looking-glass/version"

"github.com/simplifi/looking-glass/pkg/looking-glass/version"
"github.com/spf13/cobra"
)

Expand Down
9 changes: 9 additions & 0 deletions cmd/looking-glass/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

import (
"github.com/simplifi/looking-glass/cmd/looking-glass/cli"
)

func main() {
cli.Execute()
}
9 changes: 0 additions & 9 deletions main.go

This file was deleted.

13 changes: 7 additions & 6 deletions agent/agent.go → pkg/looking-glass/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package agent

import (
"fmt"
"github.com/jfrog/jfrog-client-go/artifactory"
"github.com/jfrog/jfrog-client-go/artifactory/auth"
"github.com/jfrog/jfrog-client-go/artifactory/services"
aflog "github.com/jfrog/jfrog-client-go/utils/log"
"github.com/simplifi/looking-glass/config"
"github.com/simplifi/looking-glass/downloader"
"log"
"os"
"path"
"time"

"github.com/jfrog/jfrog-client-go/artifactory"
"github.com/jfrog/jfrog-client-go/artifactory/auth"
"github.com/jfrog/jfrog-client-go/artifactory/services"
aflog "github.com/jfrog/jfrog-client-go/utils/log"
"github.com/simplifi/looking-glass/pkg/looking-glass/config"
"github.com/simplifi/looking-glass/pkg/looking-glass/downloader"
)

// Agent monitors a source for changes and pushes files to Artifactory
Expand Down
5 changes: 3 additions & 2 deletions agent/agent_test.go → pkg/looking-glass/agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package agent

import (
"fmt"
"github.com/simplifi/looking-glass/config"
"github.com/stretchr/testify/assert"
"testing"

"github.com/simplifi/looking-glass/pkg/looking-glass/config"
"github.com/stretchr/testify/assert"
)

func TestAgentNew(t *testing.T) {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package downloader

import (
"fmt"
"github.com/simplifi/looking-glass/config"

"github.com/simplifi/looking-glass/pkg/looking-glass/config"
)

// Downloader downloads objects from various sources
Expand Down
11 changes: 6 additions & 5 deletions downloader/github.go → pkg/looking-glass/downloader/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package downloader

import (
"fmt"
"github.com/google/go-github/v29/github"
"github.com/mitchellh/mapstructure"
"github.com/simplifi/looking-glass/config"
"golang.org/x/net/context"
"golang.org/x/oauth2"
"io"
"net/http"
"os"
"path"
"strings"

"github.com/google/go-github/v29/github"
"github.com/mitchellh/mapstructure"
"github.com/simplifi/looking-glass/pkg/looking-glass/config"
"golang.org/x/net/context"
"golang.org/x/oauth2"
)

type githubDownloaderConfig struct {
Expand Down
9 changes: 5 additions & 4 deletions downloader/s3.go → pkg/looking-glass/downloader/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package downloader

import (
"fmt"
"os"
"path"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
sss "github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"github.com/mitchellh/mapstructure"
"github.com/simplifi/looking-glass/config"
"os"
"path"
"strings"
"github.com/simplifi/looking-glass/pkg/looking-glass/config"
)

type s3Config struct {
Expand Down
File renamed without changes.

0 comments on commit 6074130

Please sign in to comment.