Browse Source

Updated build to use GoModules

pull/1/head
James Mills 3 years ago
parent
commit
9682849c85
Signed by: prologic GPG Key ID: AC4C014F1440EBD6
  1. 38
      .drone.yml
  2. 26
      Dockerfile
  3. 32
      Makefile
  4. 29
      README.md
  5. 7
      go.mod
  6. 15
      go.sum
  7. 1
      vendor/github.com/namsral/flag
  8. 1
      vendor/github.com/sirupsen/logrus
  9. 1
      vendor/github.com/thoj/go-ircevent
  10. 1
      vendor/golang.org/x/crypto
  11. 1
      vendor/golang.org/x/sys
  12. 15
      version.go

38
.drone.yml

@ -1,30 +1,16 @@
workspace:
base: /go
path: src/github.com/prologic/irccat
kind: pipeline
name: default
pipeline:
build:
image: golang
steps:
- name: build
image: golang:latest
commands:
- go get -d
- go build .
- make build
docker:
image: plugins/docker
repo: r.mills.io/prologic/irccat
registry: r.mills.io
secrets: [ docker_username, docker_password ]
notify:
image: drillster/drone-email
host: mail.mills.io
from: drone@mills.io
skip_verify: true
- name: notify
image: plugins/webhook
urls: https://msgbus.mills.io/ci.mills.io
when:
status: [ changed, failure ]
secrets:
registry_username:
external: true
registry_password:
external: true
status:
- success
- failure

26
Dockerfile

@ -1,28 +1,16 @@
# Build
FROM golang:alpine AS build
ARG TAG
ARG BUILD
RUN apk add --no-cache -U add git make build-base
ENV APP irccat
ENV REPO prologic/$APP
RUN apk add --update git make build-base && \
rm -rf /var/cache/apk/*
WORKDIR /go/src/github.com/$REPO
COPY . /go/src/github.com/$REPO
RUN make TAG=$TAG BUILD=$BUILD build
WORKDIR /src/irccat
COPY . /src/irccat
RUN make build install
# Runtime
FROM alpine
ENV APP irccat
ENV REPO prologic/$APP
LABEL irccat.app main
FROM alpine:latest
COPY --from=build /go/src/github.com/${REPO}/${APP} /${APP}
COPY --from=build /go/bin/irccat /irccat
ENTRYPOINT ["/irccat"]
CMD [""]
CMD []

32
Makefile

@ -1,33 +1,27 @@
.PHONY: dev build image test deps clean
.PHONY: dev build install image test deps clean
CGO_ENABLED=0
COMMIT=`git rev-parse --short HEAD`
APP=irccat
PACKAGE=
REPO?=prologic/$(APP)
TAG?=latest
BUILD?=-dev
COMMIT=$(shell git rev-parse --short HEAD)
all: dev
dev: build
@./$(APP)
@./irccat -v
deps:
@go get ./...
build:
@go build \
-tags "netgo static_build" -installsuffix netgo \
-ldflags "-w -X $(shell go list)/.Commit=$(COMMIT)" \
.
build: clean deps
@echo " -> Building $(TAG)$(BUILD)"
@go build -tags "netgo static_build" -installsuffix netgo \
-ldflags "-w -X github.com/$(REPO)/${PACKAGE}.GitCommit=$(COMMIT) -X github.com/$(REPO)/${PACKAGE}.Build=$(BUILD)" .
@echo "Built $$(./$(APP) -v)"
install: build
@go install
image:
@docker build --build-arg TAG=$(TAG) --build-arg BUILD=$(BUILD) -t $(REPO):$(TAG) .
@echo "Image created: $(REPO):$(TAG)"
@docker build -t prologic/irccat .
test:
@go test -v -cover -race $(TEST_ARGS)
@go test -v -cover -race .
clean:
@rm -rf $(APP)
@git clean -f -d -X

29
README.md

@ -1,10 +1,15 @@
# irccat - cat for IRC
[![Build Status](https://cloud.drone.io/api/badges/prologic/irccat/status.svg)](https://cloud.drone.io/prologic/irccat)
[![Go Report Card](https://goreportcard.com/badge/prologic/irccat)](https://goreportcard.com/report/prologic/irccat)
[![GoDoc](https://godoc.org/github.com/prologic/irccat?status.svg)](https://godoc.org/github.com/prologic/irccat)
[![Sourcegraph](https://sourcegraph.com/github.com/prologic/irccat/-/badge.svg)](https://sourcegraph.com/github.com/prologic/irccat?badge)
`irccat` is a simple tool that reads from standard input (*stdin*) and
posts the read message to a target IRC channel on a specified server.
Useful for simple command-line notifications, part of a pipeline, monotiring
or anything you can pipe to `ircat`. Example:
Useful for simple command-line notifications, part of a pipeline, monitoring
or anything you can pipe to `irccat`. Example:
```#!bash
echo 'Hello World!' | irccat irc.freenode.net gonuts
@ -12,8 +17,26 @@ echo 'Hello World!' | irccat irc.freenode.net gonuts
## Installation
From Source:
```#!bash
$ go -u get github.com/prologic/irccat
```
Using Docker:
```#!bash
$ docker pull prologic/irccat
```
## Usage
From Source:
```#!bash
$ echo '<message>' | irccat <address> <channel>
```
Using Docker:
```#!bash
$ go get github.com/prologic/irccat
$ echo '<message>' | docker run -i -t prologic/irccat <address> <channel>
```
## License

7
go.mod

@ -0,0 +1,7 @@
module github.com/prologic/irccat
require (
github.com/namsral/flag v1.7.4-pre
github.com/sirupsen/logrus v1.2.0
github.com/thoj/go-ircevent v0.0.0-20180816043103-14f3614f28c3
)

15
go.sum

@ -0,0 +1,15 @@
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/namsral/flag v1.7.4-pre h1:b2ScHhoCUkbsq0d2C15Mv+VU8bl8hAXV8arnWiOHNZs=
github.com/namsral/flag v1.7.4-pre/go.mod h1:OXldTctbM6SWH1K899kPZcf65KxJiD7MsceFUpB5yDo=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/thoj/go-ircevent v0.0.0-20180816043103-14f3614f28c3 h1:389FrrKIAlxqQMTscCQ7VH3JAVuxb/pe53v2LBiA7z8=
github.com/thoj/go-ircevent v0.0.0-20180816043103-14f3614f28c3/go.mod h1:QYOctLs5qEsaIrA/PKEc4YqAv2SozbxNEX0vMPs84p4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

1
vendor/github.com/namsral/flag

@ -1 +0,0 @@
Subproject commit 67f268f20922975c067ed799e4be6bacf152208c

1
vendor/github.com/sirupsen/logrus

@ -1 +0,0 @@
Subproject commit 89742aefa4b206dcf400792f3bd35b542998eb3b

1
vendor/github.com/thoj/go-ircevent

@ -1 +0,0 @@
Subproject commit db5bd176f7c6f4b2f15c46142fdc8319a365bf6e

1
vendor/golang.org/x/crypto

@ -1 +0,0 @@
Subproject commit 9f005a07e0d31d45e6656d241bb5c0f2efd4bc94

1
vendor/golang.org/x/sys

@ -1 +0,0 @@
Subproject commit bf42f188b9bc6f2cf5b8ee5a912ef1aedd0eba4c

15
version.go

@ -1,17 +1,18 @@
package main
import (
"fmt"
)
var (
// Version release version
Version = "0.0.1"
// Build will be overwritten automatically by the build system
Build = "-dev"
Version = "0.0.2"
// GitCommit will be overwritten automatically by the build system
GitCommit = "HEAD"
// Commit will be overwritten automatically by the build system
Commit = "HEAD"
)
// FullVersion display the full version and build
func FullVersion() string {
return Version + Build + " (" + GitCommit + ")"
return fmt.Sprintf("%s@%s", Version, Commit)
}

Loading…
Cancel
Save