소스 검색

Merge pull request #1 from skx/linting

Linting
Steve Kemp 5 년 전
부모
커밋
23de1bcc2f
5개의 변경된 파일75개의 추가작업 그리고 26개의 파일을 삭제
  1. 0 3
      .github/build
  2. 16 2
      .github/run-tests.sh
  3. 22 21
      README.md
  4. 12 0
      go.mod
  5. 25 0
      go.sum

+ 0 - 3
.github/build

@@ -3,9 +3,6 @@
 # The basename of our binary
 BASE="rss2hook"
 
-# Get the dependencies
-go mod init
-
 #
 # We build on only a single platform/arch.
 #

+ 16 - 2
.github/run-tests.sh

@@ -1,7 +1,21 @@
 #!/bin/sh
 
-# init modules
-go mod init
+# Install the lint-tool, and the shadow-tool
+go get -u golang.org/x/lint/golint
+go get -u golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
+
+# At this point failures cause aborts
+set -e
+
+# Run the linter
+echo "Launching linter .."
+golint -set_exit_status ./...
+echo "Completed linter .."
+
+# Run the shadow-checker
+echo "Launching shadowed-variable check .."
+go vet -vettool=$(which shadow) ./...
+echo "Completed shadowed-variable check .."
 
 # Run golang tests
 go test ./...

+ 22 - 21
README.md

@@ -2,6 +2,17 @@
 [![license](https://img.shields.io/github/license/skx/rss2hook.svg)](https://github.com/skx/rss2hook/blob/master/LICENSE)
 [![Release](https://img.shields.io/github/release/skx/rss2hook.svg)](https://github.com/skx/rss2hook/releases/latest)
 
+* [RSS2Hook](#rss2hook)
+* [Rational](#rational)
+* [Installation](#installation)
+  * [Build without Go Modules (Go before 1.11)](#build-without-go-modules-go-before-111)
+  * [Build with Go Modules (Go 1.11 or higher)](#build-with-go-modules-go-111-or-higher)
+* [Setup](#setup)
+  * [Sample Webhook Receiver](#sample-webhook-receiver)
+* [Implementation Notes](#implementation-notes)
+* [Github Setup](#github-setup)
+
+
 # RSS2Hook
 
 This project is a self-hosted utility which will make HTTP POST
@@ -25,16 +36,21 @@ github releases of projects.  For example my git-host runs [gitbucket](https://g
 * https://github.com/gitbucket/gitbucket/releases.atom
 
 
+## Installation
+
+There are two ways to install this project from source, which depend on the version of the [go](https://golang.org/) version you're using.
 
-## Deployment
+If you prefer you can fetch a binary from [our release page](https://github.com/skx/rss2hook/releases).  Currently there is only a binary for Linux (amd64) due to the use of `cgo` in our dependencies.
 
-If you have a working golang setup you should be able to install this
-application via:
+## Build without Go Modules (Go before 1.11)
 
-    go get -u  github.com/skx/rss2hook
-    go install github.com/skx/rss2hook
+    go get -u github.com/skx/rss2hook
 
-If you prefer you can fetch a binary from [our release page](github.com/skx/rss2hook/releases).  Currently there is only a binary for Linux (amd64) due to the use of `cgo` in our dependencies.
+## Build with Go Modules (Go 1.11 or higher)
+
+    git clone https://github.com/skx/rss2hook ;# make sure to clone outside of GOPATH
+    cd rss2hook
+    go install
 
 
 
@@ -95,21 +111,6 @@ upon startup.
 
 
 
-## Feedback?
-
-Turning this into a SaaS project would be interesting.  A simple setup
-would be very straight-forward to implement, however at a larger scale
-it would get more interesting:
-
-* Assume two people have subscribed to the same feed.
-   * But they did so a few days apart.
-* That means what is "new" to each of them differs.
-   * So you need to keep track of "seen" vs. "new" on a per-user __and__ per-feed basis.
-
-Anyway it would be fun to implement, but I'm not sure there is a decent
-revenue model out there for it.  Especially when you can wire up [IFTTT](https://ifttt.com/) or [similar](https://zapier.com/apps/rss/integrations/webhook/1746/send-a-webhook-when-an-rss-feed-is-updated) system to do the same thing.
-
-
 ## Github Setup
 
 This repository is configured to run tests upon every commit, and when

+ 12 - 0
go.mod

@@ -0,0 +1,12 @@
+module github.com/skx/rss2hook
+
+go 1.12
+
+require (
+	github.com/PuerkitoBio/goquery v1.5.0 // indirect
+	github.com/mmcdole/gofeed v1.0.0-beta2
+	github.com/mmcdole/goxpp v0.0.0-20181012175147-0068e33feabf // indirect
+	github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967
+	github.com/stretchr/testify v1.3.0 // indirect
+	golang.org/x/net v0.0.0-20190322120337-addf6b3196f6 // indirect
+)

+ 25 - 0
go.sum

@@ -0,0 +1,25 @@
+github.com/PuerkitoBio/goquery v1.5.0 h1:uGvmFXOA73IKluu/F84Xd1tt/z07GYm8X49XKHP7EJk=
+github.com/PuerkitoBio/goquery v1.5.0/go.mod h1:qD2PgZ9lccMbQlc7eEOjaeRlFQON7xY8kdmcsrnKqMg=
+github.com/andybalholm/cascadia v1.0.0 h1:hOCXnnZ5A+3eVDX8pvgl4kofXv2ELss0bKcqRySc45o=
+github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
+github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/mmcdole/gofeed v1.0.0-beta2 h1:CjQ0ADhAwNSb08zknAkGOEYqr8zfZKfrzgk9BxpWP2E=
+github.com/mmcdole/gofeed v1.0.0-beta2/go.mod h1:/BF9JneEL2/flujm8XHoxUcghdTV6vvb3xx/vKyChFU=
+github.com/mmcdole/goxpp v0.0.0-20181012175147-0068e33feabf h1:sWGE2v+hO0Nd4yFU/S/mDBM5plIU8v/Qhfz41hkDIAI=
+github.com/mmcdole/goxpp v0.0.0-20181012175147-0068e33feabf/go.mod h1:pasqhqstspkosTneA62Nc+2p9SOBBYAPbnmRRWPQ0V8=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967 h1:x7xEyJDP7Hv3LVgvWhzioQqbC/KtuUhTigKlH/8ehhE=
+github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190322120337-addf6b3196f6 h1:78jEq2G3J16aXneH23HSnTQQTCwMHoyO8VEiUH+bpPM=
+golang.org/x/net v0.0.0-20190322120337-addf6b3196f6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=