Add go.mod file
This commit is contained in:
Родитель
edfd9ccadb
Коммит
3888771325
|
@ -0,0 +1,36 @@
|
|||
module github.com/go-gitea/lgtm
|
||||
|
||||
go 1.15
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v0.1.1-0.20150501104042-056c9bc7be71
|
||||
github.com/Sirupsen/logrus v0.6.7-0.20150309155839-2cea0f0d141f
|
||||
github.com/dgrijalva/jwt-go v2.2.1-0.20150401180636-c48cfd5d9711+incompatible
|
||||
github.com/elazarl/go-bindata-assetfs v0.0.0-20150414184409-bea323321994
|
||||
github.com/franela/goblin v0.0.0-20150112000940-2042c4d610d2
|
||||
github.com/gin-gonic/contrib v0.0.0-20150815172543-14f66d54cdb9
|
||||
github.com/gin-gonic/gin v0.0.0-20160414233928-5caaac4c5c71
|
||||
github.com/go-sql-driver/mysql v1.2.1-0.20151112163355-d512f204a577
|
||||
github.com/golang/protobuf v0.0.0-20160418235422-2ebff28ac76f // indirect
|
||||
github.com/google/go-github v14.0.1-0.20171221173707-0c3b302de2a6+incompatible
|
||||
github.com/google/go-querystring v0.0.0-20151028211038-2a60fc2ba6c1 // indirect
|
||||
github.com/ianschenck/envflag v0.0.0-20140720210342-9111d830d133
|
||||
github.com/joho/godotenv v0.0.0-20150907010228-4ed13390c0ac
|
||||
github.com/koding/cache v0.0.0-20140912085602-487fc0ca06f9
|
||||
github.com/lib/pq v0.0.0-20161103024354-d8eeeb8bae88
|
||||
github.com/manucorporat/sse v0.0.0-20150715184805-fe6ea2c8e398 // indirect
|
||||
github.com/mattn/go-sqlite3 v0.0.0-20150427235825-542ae647f860
|
||||
github.com/rubenv/sql-migrate v0.0.0-20150713140751-53184e1edfb4
|
||||
github.com/russross/meddler v0.0.0-20150103201139-cd98050d9328
|
||||
github.com/stretchr/objx v0.0.0-20140526180921-cbeaeb16a013 // indirect
|
||||
github.com/stretchr/testify v0.0.0-20150504220033-73a8112e0560
|
||||
github.com/ziutek/mymysql v1.5.4 // indirect
|
||||
golang.org/x/net v0.0.0-20151128090656-62ac18b46160
|
||||
golang.org/x/oauth2 v0.0.0-20151117210313-442624c9ec92
|
||||
google.golang.org/appengine v0.0.0-20160914034556-78199dcb0669 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
|
||||
gopkg.in/go-playground/validator.v8 v8.17.1 // indirect
|
||||
gopkg.in/gorp.v1 v1.7.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.0.0-20160301204022-a83829b6f129 // indirect
|
||||
)
|
|
@ -0,0 +1,65 @@
|
|||
github.com/BurntSushi/toml v0.1.1-0.20150501104042-056c9bc7be71 h1:KAQc1CTRbk1f17TCGJgSL5kOTzbT7luTSdD+O8FLUNg=
|
||||
github.com/BurntSushi/toml v0.1.1-0.20150501104042-056c9bc7be71/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/Sirupsen/logrus v0.6.7-0.20150309155839-2cea0f0d141f h1:KayOYr2WCWZ+MZc/++3EQP7dieYjuMZSsupz2PSVzyw=
|
||||
github.com/Sirupsen/logrus v0.6.7-0.20150309155839-2cea0f0d141f/go.mod h1:rmk17hk6i8ZSAJkSDa7nOxamrG+SP4P0mm+DAvExv4U=
|
||||
github.com/dgrijalva/jwt-go v2.2.1-0.20150401180636-c48cfd5d9711+incompatible h1:VB+e14ByfqYy11hkJRzdl+dn9hK1rSB0tgpH4+hnk20=
|
||||
github.com/dgrijalva/jwt-go v2.2.1-0.20150401180636-c48cfd5d9711+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/elazarl/go-bindata-assetfs v0.0.0-20150414184409-bea323321994 h1:6YgvX4LNhWIUuRaoeB332enMLVgHcJPk+K9gc1Dovcc=
|
||||
github.com/elazarl/go-bindata-assetfs v0.0.0-20150414184409-bea323321994/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
||||
github.com/franela/goblin v0.0.0-20150112000940-2042c4d610d2 h1:PcbwRGOqYeTQw76GRthRaxNGII82C/kx46ll3aNqDMQ=
|
||||
github.com/franela/goblin v0.0.0-20150112000940-2042c4d610d2/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
|
||||
github.com/gin-gonic/contrib v0.0.0-20150815172543-14f66d54cdb9 h1:gISPkiYdlRqAEbns25dOAoT/w5dxhI4ACWUYfTr3dFQ=
|
||||
github.com/gin-gonic/contrib v0.0.0-20150815172543-14f66d54cdb9/go.mod h1:iqneQ2Df3omzIVTkIfn7c1acsVnMGiSLn4XF5Blh3Yg=
|
||||
github.com/gin-gonic/gin v0.0.0-20160414233928-5caaac4c5c71 h1:ML+SQEYkMC4dDaXPRUyIOI0mbbXBdIvquVspxzzJ54E=
|
||||
github.com/gin-gonic/gin v0.0.0-20160414233928-5caaac4c5c71/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y=
|
||||
github.com/go-sql-driver/mysql v1.2.1-0.20151112163355-d512f204a577 h1:LNG8An1v6hzhHTbBF1acgFTm9f5d1f1cIC/lAfGeaGM=
|
||||
github.com/go-sql-driver/mysql v1.2.1-0.20151112163355-d512f204a577/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/golang/protobuf v0.0.0-20160418235422-2ebff28ac76f h1:tPg7dtyApX0wJICu6l4E+y8emibrteBhDBeiA5HQr2Q=
|
||||
github.com/golang/protobuf v0.0.0-20160418235422-2ebff28ac76f/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/google/go-github v14.0.1-0.20171221173707-0c3b302de2a6+incompatible h1:ipPiYkTHyGElNRP6fGeN+YL+N7lTqMG7tBIROI1/0Tw=
|
||||
github.com/google/go-github v14.0.1-0.20171221173707-0c3b302de2a6+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
|
||||
github.com/google/go-querystring v0.0.0-20151028211038-2a60fc2ba6c1 h1:ULA7QZ5KGgwOBeBBCA7Xyv96fmriEfhs0D2KDRslTd8=
|
||||
github.com/google/go-querystring v0.0.0-20151028211038-2a60fc2ba6c1/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/ianschenck/envflag v0.0.0-20140720210342-9111d830d133 h1:h6FO/Da7rdYqJbRYMW9f+SMBWnJVguWh+0ERefW8zp8=
|
||||
github.com/ianschenck/envflag v0.0.0-20140720210342-9111d830d133/go.mod h1:pyYc5lldRtL0l5YitYVv1dLKuC0qhMfAfiR7BLsN2pA=
|
||||
github.com/joho/godotenv v0.0.0-20150907010228-4ed13390c0ac h1:wF2VgtpbaLqhBHV9FxVWzgzgv8VcCjZ66Bl/+F6cpT0=
|
||||
github.com/joho/godotenv v0.0.0-20150907010228-4ed13390c0ac/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||
github.com/koding/cache v0.0.0-20140912085602-487fc0ca06f9 h1:wAnE6YoDViB3XyrvdSL9M+9EuVnWeAe9LQT1SgZm+pU=
|
||||
github.com/koding/cache v0.0.0-20140912085602-487fc0ca06f9/go.mod h1:sh5SGGmQVGUkWDnxevz0I2FJ4TeC18hRPRjKVBMb2kA=
|
||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/lib/pq v0.0.0-20161103024354-d8eeeb8bae88 h1:H9VJjFCpY9dwA9RdOHAyAR2nRRksPoLSPzEXUUjm86Y=
|
||||
github.com/lib/pq v0.0.0-20161103024354-d8eeeb8bae88/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/manucorporat/sse v0.0.0-20150715184805-fe6ea2c8e398 h1:dpbqQadB3NxFdAIk2VxZKXGDDGzle12DjOL3arqwhTM=
|
||||
github.com/manucorporat/sse v0.0.0-20150715184805-fe6ea2c8e398/go.mod h1:zUx1mhth20V3VKgL5jbd1BSQcW4Fy6Qs4PZvQwRFwzM=
|
||||
github.com/mattn/go-sqlite3 v0.0.0-20150427235825-542ae647f860 h1:9h5oClvcMu0tJ1o7q0xBGUjAlxLxgFJdmrF4jOSnfmU=
|
||||
github.com/mattn/go-sqlite3 v0.0.0-20150427235825-542ae647f860/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/rubenv/sql-migrate v0.0.0-20150713140751-53184e1edfb4 h1:0V/8cK9e1VQ9zXGMoIscgkhYpDlAtUKy8DJp7MEO2NU=
|
||||
github.com/rubenv/sql-migrate v0.0.0-20150713140751-53184e1edfb4/go.mod h1:WS0rl9eEliYI8DPnr3TOwz4439pay+qNgzJoVya/DmY=
|
||||
github.com/russross/meddler v0.0.0-20150103201139-cd98050d9328 h1:CQa01/PmNg3Eti9Y45GoHcLTg8xJE1ASSinFSV9sYTs=
|
||||
github.com/russross/meddler v0.0.0-20150103201139-cd98050d9328/go.mod h1:L0qig4K5sCW6YvsjqjPgkKJpwphlhMX1SmjGdcKXbsw=
|
||||
github.com/stretchr/objx v0.0.0-20140526180921-cbeaeb16a013 h1:lg5xphrNMF4T2GfLhtXOhFrTn5ZmPRUOWXvCLOattFY=
|
||||
github.com/stretchr/objx v0.0.0-20140526180921-cbeaeb16a013/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v0.0.0-20150504220033-73a8112e0560 h1:31NOTyLbv+UxIuNTCM8ZohLNcRpbxIxAswT78UmHdTA=
|
||||
github.com/stretchr/testify v0.0.0-20150504220033-73a8112e0560/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
|
||||
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
|
||||
golang.org/x/net v0.0.0-20151128090656-62ac18b46160 h1:O608IN7+UsaAJS2Psd4ssrFw0Hu7eAhvXSkPfkBAGAs=
|
||||
golang.org/x/net v0.0.0-20151128090656-62ac18b46160/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/oauth2 v0.0.0-20151117210313-442624c9ec92 h1:0FRR4KY6PUwtJ/49qIfat4aVfs1a6rA0R0FgClC7aqA=
|
||||
golang.org/x/oauth2 v0.0.0-20151117210313-442624c9ec92/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
google.golang.org/appengine v0.0.0-20160914034556-78199dcb0669 h1:Gn/iNp0aEQHNkLa3fPIB1MaMpzxY0MopwQfO1mHVjBM=
|
||||
google.golang.org/appengine v0.0.0-20160914034556-78199dcb0669/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
|
||||
gopkg.in/go-playground/validator.v8 v8.17.1 h1:W1Q1z7rfiJiNhoBkHYqb9TJAdOqPXsyNeZ+8cAzP+kg=
|
||||
gopkg.in/go-playground/validator.v8 v8.17.1/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
|
||||
gopkg.in/gorp.v1 v1.7.1 h1:GBB9KrWRATQZh95HJyVGUZrWwOPswitEYEyqlK8JbAA=
|
||||
gopkg.in/gorp.v1 v1.7.1/go.mod h1:Wo3h+DBQZIxATwftsglhdD/62zRFPhGhTiu5jUJmCaw=
|
||||
gopkg.in/yaml.v2 v2.0.0-20160301204022-a83829b6f129 h1:RBgb9aPUbZ9nu66ecQNIBNsA7j3mB5h8PNDIfhPjaJg=
|
||||
gopkg.in/yaml.v2 v2.0.0-20160301204022-a83829b6f129/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
|
@ -0,0 +1,5 @@
|
|||
TAGS
|
||||
tags
|
||||
.*.swp
|
||||
tomlcheck/tomlcheck
|
||||
toml.test
|
|
@ -0,0 +1,12 @@
|
|||
language: go
|
||||
go:
|
||||
- 1.1
|
||||
- 1.2
|
||||
- tip
|
||||
install:
|
||||
- go install ./...
|
||||
- go get github.com/BurntSushi/toml-test
|
||||
script:
|
||||
- export PATH="$PATH:$HOME/gopath/bin"
|
||||
- make test
|
||||
|
|
@ -0,0 +1 @@
|
|||
logrus
|
|
@ -0,0 +1,8 @@
|
|||
language: go
|
||||
go:
|
||||
- 1.2
|
||||
- 1.3
|
||||
- 1.4
|
||||
- tip
|
||||
install:
|
||||
- go get -t ./...
|
|
@ -0,0 +1,4 @@
|
|||
.DS_Store
|
||||
bin
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
|
@ -0,0 +1,8 @@
|
|||
language: go
|
||||
go:
|
||||
- 1.1.2
|
||||
- tip
|
||||
notifications:
|
||||
email:
|
||||
- ionathan@gmail.com
|
||||
- marcosnils@gmail.com
|
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 13 KiB После Ширина: | Высота: | Размер: 18 KiB |
|
@ -0,0 +1,4 @@
|
|||
Godeps/*
|
||||
!Godeps/Godeps.json
|
||||
coverage.out
|
||||
count.out
|
|
@ -0,0 +1,23 @@
|
|||
language: go
|
||||
sudo: false
|
||||
go:
|
||||
- 1.4
|
||||
- 1.5
|
||||
- 1.6
|
||||
- tip
|
||||
|
||||
script:
|
||||
- go get golang.org/x/tools/cmd/cover
|
||||
- go get github.com/mattn/goveralls
|
||||
- go test -v -covermode=count -coverprofile=coverage.out
|
||||
|
||||
after_success:
|
||||
- goveralls -coverprofile=coverage.out -service=travis-ci -repotoken yFj7FrCeddvBzUaaCyG33jCLfWXeb93eA
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/acc2c57482e94b44f557
|
||||
on_success: change # options: [always|never|change] default: always
|
||||
on_failure: always # options: [always|never|change] default: always
|
||||
on_start: false # default: false
|
|
@ -0,0 +1,8 @@
|
|||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
Icon?
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
|
@ -0,0 +1,10 @@
|
|||
sudo: false
|
||||
language: go
|
||||
go:
|
||||
- 1.2
|
||||
- 1.3
|
||||
- 1.4
|
||||
- tip
|
||||
|
||||
before_script:
|
||||
- mysql -e 'create database gotest;'
|
|
@ -0,0 +1,3 @@
|
|||
# This source code refers to The Go Authors for copyright purposes.
|
||||
# The master list of authors is in the main Go distribution,
|
||||
# visible at http://tip.golang.org/AUTHORS.
|
|
@ -0,0 +1,3 @@
|
|||
# This source code was written by the Go contributors.
|
||||
# The master list of contributors is in the main Go distribution,
|
||||
# visible at http://tip.golang.org/CONTRIBUTORS.
|
|
@ -0,0 +1,168 @@
|
|||
# This is the official list of go-github authors for copyright purposes.
|
||||
#
|
||||
# This does not necessarily list everyone who has contributed code, since in
|
||||
# some cases, their employer may be the copyright holder. To see the full list
|
||||
# of contributors, see the revision history in source control or
|
||||
# https://github.com/google/go-github/graphs/contributors.
|
||||
#
|
||||
# Authors who wish to be recognized in this file should add themselves (or
|
||||
# their employer, as appropriate).
|
||||
|
||||
178inaba <masahiro.furudate@gmail.com>
|
||||
Abhinav Gupta <mail@abhinavg.net>
|
||||
Ahmed Hagy <a.akram93@gmail.com>
|
||||
Ainsley Chong <ainsley.chong@gmail.com>
|
||||
Akeda Bagus <akeda@x-team.com>
|
||||
Alec Thomas <alec@swapoff.org>
|
||||
Aleks Clark <aleks.clark@gmail.com>
|
||||
Alex Bramley <a.bramley@gmail.com>
|
||||
Alexander Harkness <me@bearbin.net>
|
||||
Allen Sun <shlallen1990@gmail.com>
|
||||
Amey Sakhadeo <me@ameyms.com>
|
||||
Andreas Garnæs <https://github.com/andreas>
|
||||
Andrew Ryabchun <aryabchun@mail.ua>
|
||||
Andy Hume <andyhume@gmail.com>
|
||||
Andy Lindeman <andy@lindeman.io>
|
||||
Anshuman Bhartiya <anshuman.bhartiya@gmail.com>
|
||||
Antoine Pelisse <apelisse@gmail.com>
|
||||
Aravind <aravindkp@outlook.in>
|
||||
Arıl Bozoluk <arilbozoluk@hotmail.com>
|
||||
Austin Dizzy <dizzy@wow.com>
|
||||
Beshr Kayali <beshrkayali@gmail.com>
|
||||
Beyang Liu <beyang.liu@gmail.com>
|
||||
Billy Lynch <wlynch92@gmail.com>
|
||||
Björn Häuser <b.haeuser@rebuy.de>
|
||||
Brad Harris <bmharris@gmail.com>
|
||||
Bradley Falzon <brad@teambrad.net>
|
||||
Brian Egizi <brian@mojotech.com>
|
||||
Bryan Boreham <bryan@weave.works>
|
||||
Cami Diez <diezcami@gmail.com>
|
||||
Carlos Alexandro Becker <caarlos0@gmail.com>
|
||||
chandresh-pancholi <chandreshpancholi007@gmail.com>
|
||||
Charlie Yan <charlieyan08@gmail.com>
|
||||
Chris King <chriskingnet@gmail.com>
|
||||
Chris Roche <chris@vsco.co>
|
||||
Chris Schaefer <chris@dtzq.com>
|
||||
Christoph Sassenberg <defsprite@gmail.com>
|
||||
Colin Misare <github.com/cmisare>
|
||||
Craig Peterson <cpeterson@stackoverflow.com>
|
||||
Cristian Maglie <c.maglie@bug.st>
|
||||
Daehyeok Mun <daehyeok@gmail.com>
|
||||
Daniel Leavitt <daniel.leavitt@gmail.com>
|
||||
Dave Du Cros <davidducros@gmail.com>
|
||||
Dave Henderson <dhenderson@gmail.com>
|
||||
David Deng <daviddengcn@gmail.com>
|
||||
Dennis Webb <dennis@bluesentryit.com>
|
||||
Diego Lapiduz <diego.lapiduz@cfpb.gov>
|
||||
Dmitri Shuralyov <shurcooL@gmail.com>
|
||||
dmnlk <seikima2demon@gmail.com>
|
||||
Don Petersen <don@donpetersen.net>
|
||||
Doug Turner <doug.turner@gmail.com>
|
||||
Drew Fradette <drew.fradette@gmail.com>
|
||||
Eli Uriegas <seemethere101@gmail.com>
|
||||
Elliott Beach <elliott2.71828@gmail.com>
|
||||
erwinvaneyk <erwinvaneyk@gmail.com>
|
||||
Fabrice <fabrice.vaillant@student.ecp.fr>
|
||||
Filippo Valsorda <hi@filippo.io>
|
||||
Florian Forster <ff@octo.it>
|
||||
Francesc Gil <xescugil@gmail.com>
|
||||
Francis <hello@francismakes.com>
|
||||
Fredrik Jönsson <fredrik.jonsson@izettle.com>
|
||||
Garrett Squire <garrettsquire@gmail.com>
|
||||
Georgy Buranov <gburanov@gmail.com>
|
||||
Gnahz <p@oath.pl>
|
||||
Google Inc.
|
||||
griffin_stewie <panterathefamilyguy@gmail.com>
|
||||
Guz Alexander <kalimatas@gmail.com>
|
||||
Hanno Hecker <hanno.hecker@zalando.de>
|
||||
Hari haran <hariharan.uno@gmail.com>
|
||||
haya14busa <hayabusa1419@gmail.com>
|
||||
Huy Tr <kingbazoka@gmail.com>
|
||||
huydx <doxuanhuy@gmail.com>
|
||||
i2bskn <i2bskn@gmail.com>
|
||||
Isao Jonas <isao.jonas@gmail.com>
|
||||
isqua <isqua@isqua.ru>
|
||||
Jameel Haffejee <RC1140@republiccommandos.co.za>
|
||||
Jan Kosecki <jan.kosecki91@gmail.com>
|
||||
Jeremy Morris <jeremylevanmorris@gmail.com>
|
||||
Jihoon Chung <j.c@navercorp.com>
|
||||
Jimmi Dyson <jimmidyson@gmail.com>
|
||||
Joe Tsai <joetsai@digital-static.net>
|
||||
John Engelman <john.r.engelman@gmail.com>
|
||||
jpbelanger-mtl <jp.belanger@gmail.com>
|
||||
Juan Basso <jrbasso@gmail.com>
|
||||
Julien Rostand <jrostand@users.noreply.github.com>
|
||||
Justin Abrahms <justin@abrah.ms>
|
||||
jzhoucliqr <jzhou@cliqr.com>
|
||||
Katrina Owen <kytrinyx@github.com>
|
||||
Keita Urashima <ursm@ursm.jp>
|
||||
Kevin Burke <kev@inburke.com>
|
||||
Konrad Malawski <konrad.malawski@project13.pl>
|
||||
Kookheon Kwon <kucuny@gmail.com>
|
||||
Krzysztof Kowalczyk <kkowalczyk@gmail.com>
|
||||
kyokomi <kyoko1220adword@gmail.com>
|
||||
Lucas Alcantara <lucasalcantaraf@gmail.com>
|
||||
Luke Evers <me@lukevers.com>
|
||||
Luke Kysow <lkysow@gmail.com>
|
||||
Luke Roberts <email@luke-roberts.co.uk>
|
||||
Luke Young <luke@hydrantlabs.org>
|
||||
Maksim Zhylinski <uzzable@gmail.com>
|
||||
Martin-Louis Bright <mlbright@gmail.com>
|
||||
Mat Geist <matgeist@gmail.com>
|
||||
Matt Brender <mjbrender@gmail.com>
|
||||
Matt Landis <landis.matt@gmail.com>
|
||||
Maxime Bury <maxime.bury@gmail.com>
|
||||
Michael Tiller <michael.tiller@gmail.com>
|
||||
Michał Glapa <michal.glapa@gmail.com>
|
||||
Nathan VanBenschoten <nvanbenschoten@gmail.com>
|
||||
Neil O'Toole <neilotoole@apache.org>
|
||||
Nick Miyake <nmiyake@palantir.com>
|
||||
Nick Spragg <nick.spragg@bbc.co.uk>
|
||||
Nikhita Raghunath <nikitaraghunath@gmail.com>
|
||||
Noah Zoschke <noah+sso2@convox.com>
|
||||
ns-cweber <cweber@narrativescience.com>
|
||||
Ondřej Kupka <ondra.cap@gmail.com>
|
||||
Panagiotis Moustafellos <pmoust@gmail.com>
|
||||
Parker Moore <parkrmoore@gmail.com>
|
||||
Pavel Shtanko <pavel.shtanko@gmail.com>
|
||||
Petr Shevtsov <petr.shevtsov@gmail.com>
|
||||
Pierre Carrier <pierre@meteor.com>
|
||||
Piotr Zurek <p.zurek@gmail.com>
|
||||
Quinn Slack <qslack@qslack.com>
|
||||
Rackspace US, Inc.
|
||||
RaviTeja Pothana <ravi-teja@live.com>
|
||||
rc1140 <jameel@republiccommandos.co.za>
|
||||
Red Hat, Inc.
|
||||
Rob Figueiredo <robfig@yext.com>
|
||||
Ronak Jain <ronakjain@outlook.in>
|
||||
Ruben Vereecken <rubenvereecken@gmail.com>
|
||||
Ryan Lower <rpjlower@gmail.com>
|
||||
Sahil Dua <sahildua2305@gmail.com>
|
||||
saisi <saisi@users.noreply.github.com>
|
||||
Sam Minnée <sam@silverstripe.com>
|
||||
Sander van Harmelen <svanharmelen@schubergphilis.com>
|
||||
Sarasa Kisaragi <lingsamuelgrace@gmail.com>
|
||||
Sean Wang <sean@decrypted.org>
|
||||
Sebastian Mandrean <sebastian.mandrean@gmail.com>
|
||||
Sebastian Mæland Pedersen <sem.pedersen@stud.uis.no>
|
||||
Sevki <s@sevki.org>
|
||||
Shawn Catanzarite <me@shawncatz.com>
|
||||
Shawn Smith <shawnpsmith@gmail.com>
|
||||
sona-tar <sona.zip@gmail.com>
|
||||
SoundCloud, Ltd.
|
||||
Stian Eikeland <stian@eikeland.se>
|
||||
Thomas Bruyelle <thomas.bruyelle@gmail.com>
|
||||
Timothée Peignier <timothee.peignier@tryphon.org>
|
||||
Trey Tacon <ttacon@gmail.com>
|
||||
ttacon <ttacon@gmail.com>
|
||||
Varadarajan Aravamudhan <varadaraajan@gmail.com>
|
||||
Victor Castell <victor@victorcastell.com>
|
||||
Victor Vrantchan <vrancean+github@gmail.com>
|
||||
Vlad Ungureanu <vladu@palantir.com>
|
||||
Will Maier <wcmaier@gmail.com>
|
||||
William Bailey <mail@williambailey.org.uk>
|
||||
Yann Malet <yann.malet@gmail.com>
|
||||
Yannick Utard <yannickutard@gmail.com>
|
||||
Yicheng Qin <qycqycqycqycqyc@gmail.com>
|
||||
Yumikiyo Osanai <yumios.art@gmail.com>
|
||||
Zach Latta <zach@zachlatta.com>
|
|
@ -1,114 +0,0 @@
|
|||
# How to contribute #
|
||||
|
||||
We'd love to accept your patches and contributions to this project. There are
|
||||
a just a few small guidelines you need to follow.
|
||||
|
||||
|
||||
## Contributor License Agreement ##
|
||||
|
||||
Contributions to any Google project must be accompanied by a Contributor
|
||||
License Agreement. This is not a copyright **assignment**, it simply gives
|
||||
Google permission to use and redistribute your contributions as part of the
|
||||
project. Head over to <https://cla.developers.google.com/> to see your current
|
||||
agreements on file or to sign a new one.
|
||||
|
||||
You generally only need to submit a CLA once, so if you've already submitted one
|
||||
(even if it was for a different project), you probably don't need to do it
|
||||
again.
|
||||
|
||||
|
||||
## Submitting a patch ##
|
||||
|
||||
1. It's generally best to start by opening a new issue describing the bug or
|
||||
feature you're intending to fix. Even if you think it's relatively minor,
|
||||
it's helpful to know what people are working on. Mention in the initial
|
||||
issue that you are planning to work on that bug or feature so that it can
|
||||
be assigned to you.
|
||||
|
||||
1. Follow the normal process of [forking][] the project, and setup a new
|
||||
branch to work in. It's important that each group of changes be done in
|
||||
separate branches in order to ensure that a pull request only includes the
|
||||
commits related to that bug or feature.
|
||||
|
||||
1. Go makes it very simple to ensure properly formatted code, so always run
|
||||
`go fmt` on your code before committing it. You should also run
|
||||
[golint][] over your code. As noted in the [golint readme][], it's not
|
||||
strictly necessary that your code be completely "lint-free", but this will
|
||||
help you find common style issues.
|
||||
|
||||
1. Any significant changes should almost always be accompanied by tests. The
|
||||
project already has good test coverage, so look at some of the existing
|
||||
tests if you're unsure how to go about it. [gocov][] and [gocov-html][]
|
||||
are invaluable tools for seeing which parts of your code aren't being
|
||||
exercised by your tests.
|
||||
|
||||
1. Please run:
|
||||
* `go generate github.com/google/go-github/...`
|
||||
* `go test github.com/google/go-github/...`
|
||||
* `go vet github.com/google/go-github/...`
|
||||
|
||||
1. Do your best to have [well-formed commit messages][] for each change.
|
||||
This provides consistency throughout the project, and ensures that commit
|
||||
messages are able to be formatted properly by various git tools.
|
||||
|
||||
1. Finally, push the commits to your fork and submit a [pull request][].
|
||||
|
||||
[forking]: https://help.github.com/articles/fork-a-repo
|
||||
[golint]: https://github.com/golang/lint
|
||||
[golint readme]: https://github.com/golang/lint/blob/master/README.md
|
||||
[gocov]: https://github.com/axw/gocov
|
||||
[gocov-html]: https://github.com/matm/gocov-html
|
||||
[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
||||
[squash]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits
|
||||
[pull request]: https://help.github.com/articles/creating-a-pull-request
|
||||
|
||||
|
||||
## Other notes on code organization ##
|
||||
|
||||
Currently, everything is defined in the main `github` package, with API methods
|
||||
broken into separate service objects. These services map directly to how
|
||||
the [GitHub API documentation][] is organized, so use that as your guide for
|
||||
where to put new methods.
|
||||
|
||||
Code is organized in files also based pretty closely on the GitHub API
|
||||
documentation, following the format `{service}_{api}.go`. For example, methods
|
||||
defined at <https://developer.github.com/v3/repos/hooks/> live in
|
||||
[repos_hooks.go][].
|
||||
|
||||
[GitHub API documentation]: https://developer.github.com/v3/
|
||||
[repos_hooks.go]: https://github.com/google/go-github/blob/master/github/repos_hooks.go
|
||||
|
||||
|
||||
## Maintainer's Guide ##
|
||||
|
||||
(These notes are mostly only for people merging in pull requests.)
|
||||
|
||||
**Verify CLAs.** CLAs must be on file for the pull request submitter and commit
|
||||
author(s). Google's CLA verification system should handle this automatically
|
||||
and will set commit statuses as appropriate. If there's ever any question about
|
||||
a pull request, ask [willnorris](https://github.com/willnorris).
|
||||
|
||||
**Always try to maintain a clean, linear git history.** With very few
|
||||
exceptions, running `git log` should not show a bunch of branching and merging.
|
||||
|
||||
Never use the GitHub "merge" button, since it always creates a merge commit.
|
||||
Instead, check out the pull request locally ([these git aliases
|
||||
help][git-aliases]), then cherry-pick or rebase them onto master. If there are
|
||||
small cleanup commits, especially as a result of addressing code review
|
||||
comments, these should almost always be squashed down to a single commit. Don't
|
||||
bother squashing commits that really deserve to be separate though. If needed,
|
||||
feel free to amend additional small changes to the code or commit message that
|
||||
aren't worth going through code review for.
|
||||
|
||||
If you made any changes like squashing commits, rebasing onto master, etc, then
|
||||
GitHub won't recognize that this is the same commit in order to mark the pull
|
||||
request as "merged". So instead, amend the commit message to include a line
|
||||
"Fixes #0", referencing the pull request number. This would be in addition to
|
||||
any other "Fixes" lines for closing related issues. If you forget to do this,
|
||||
you can also leave a comment on the pull request [like this][rebase-comment].
|
||||
If you made any other changes, it's worth noting that as well, [like
|
||||
this][modified-comment].
|
||||
|
||||
[git-aliases]: https://github.com/willnorris/dotfiles/blob/d640d010c23b1116bdb3d4dc12088ed26120d87d/git/.gitconfig#L13-L15
|
||||
[rebase-comment]: https://github.com/google/go-github/pull/277#issuecomment-183035491
|
||||
[modified-comment]: https://github.com/google/go-github/pull/280#issuecomment-184859046
|
|
@ -1,244 +0,0 @@
|
|||
# go-github #
|
||||
|
||||
go-github is a Go client library for accessing the [GitHub API v3][].
|
||||
|
||||
**Documentation:** [![GoDoc](https://godoc.org/github.com/google/go-github/github?status.svg)](https://godoc.org/github.com/google/go-github/github)
|
||||
**Mailing List:** [go-github@googlegroups.com](https://groups.google.com/group/go-github)
|
||||
**Build Status:** [![Build Status](https://travis-ci.org/google/go-github.svg?branch=master)](https://travis-ci.org/google/go-github)
|
||||
**Test Coverage:** [![Test Coverage](https://coveralls.io/repos/google/go-github/badge.svg?branch=master)](https://coveralls.io/r/google/go-github?branch=master)
|
||||
|
||||
go-github requires Go version 1.7 or greater.
|
||||
|
||||
If you're interested in using the [GraphQL API v4][], the recommended library is
|
||||
[shurcooL/githubql][].
|
||||
|
||||
## Usage ##
|
||||
|
||||
```go
|
||||
import "github.com/google/go-github/github"
|
||||
```
|
||||
|
||||
Construct a new GitHub client, then use the various services on the client to
|
||||
access different parts of the GitHub API. For example:
|
||||
|
||||
```go
|
||||
client := github.NewClient(nil)
|
||||
|
||||
// list all organizations for user "willnorris"
|
||||
orgs, _, err := client.Organizations.List(ctx, "willnorris", nil)
|
||||
```
|
||||
|
||||
Some API methods have optional parameters that can be passed. For example:
|
||||
|
||||
```go
|
||||
client := github.NewClient(nil)
|
||||
|
||||
// list public repositories for org "github"
|
||||
opt := &github.RepositoryListByOrgOptions{Type: "public"}
|
||||
repos, _, err := client.Repositories.ListByOrg(ctx, "github", opt)
|
||||
```
|
||||
|
||||
The services of a client divide the API into logical chunks and correspond to
|
||||
the structure of the GitHub API documentation at
|
||||
https://developer.github.com/v3/.
|
||||
|
||||
### Authentication ###
|
||||
|
||||
The go-github library does not directly handle authentication. Instead, when
|
||||
creating a new client, pass an `http.Client` that can handle authentication for
|
||||
you. The easiest and recommended way to do this is using the [oauth2][]
|
||||
library, but you can always use any other library that provides an
|
||||
`http.Client`. If you have an OAuth2 access token (for example, a [personal
|
||||
API token][]), you can use it with the oauth2 library using:
|
||||
|
||||
```go
|
||||
import "golang.org/x/oauth2"
|
||||
|
||||
func main() {
|
||||
ctx := context.Background()
|
||||
ts := oauth2.StaticTokenSource(
|
||||
&oauth2.Token{AccessToken: "... your access token ..."},
|
||||
)
|
||||
tc := oauth2.NewClient(ctx, ts)
|
||||
|
||||
client := github.NewClient(tc)
|
||||
|
||||
// list all repositories for the authenticated user
|
||||
repos, _, err := client.Repositories.List(ctx, "", nil)
|
||||
}
|
||||
```
|
||||
|
||||
Note that when using an authenticated Client, all calls made by the client will
|
||||
include the specified OAuth token. Therefore, authenticated clients should
|
||||
almost never be shared between different users.
|
||||
|
||||
See the [oauth2 docs][] for complete instructions on using that library.
|
||||
|
||||
For API methods that require HTTP Basic Authentication, use the
|
||||
[`BasicAuthTransport`](https://godoc.org/github.com/google/go-github/github#BasicAuthTransport).
|
||||
|
||||
GitHub Apps authentication can be provided by the [ghinstallation](https://github.com/bradleyfalzon/ghinstallation)
|
||||
package.
|
||||
|
||||
```go
|
||||
import "github.com/bradleyfalzon/ghinstallation"
|
||||
|
||||
func main() {
|
||||
// Wrap the shared transport for use with the integration ID 1 authenticating with installation ID 99.
|
||||
itr, err := ghinstallation.NewKeyFromFile(http.DefaultTransport, 1, 99, "2016-10-19.private-key.pem")
|
||||
if err != nil {
|
||||
// Handle error.
|
||||
}
|
||||
|
||||
// Use installation transport with client.
|
||||
client := github.NewClient(&http.Client{Transport: itr})
|
||||
|
||||
// Use client...
|
||||
}
|
||||
```
|
||||
|
||||
### Rate Limiting ###
|
||||
|
||||
GitHub imposes a rate limit on all API clients. Unauthenticated clients are
|
||||
limited to 60 requests per hour, while authenticated clients can make up to
|
||||
5,000 requests per hour. The Search API has a custom rate limit. Unauthenticated
|
||||
clients are limited to 10 requests per minute, while authenticated clients
|
||||
can make up to 30 requests per minute. To receive the higher rate limit when
|
||||
making calls that are not issued on behalf of a user,
|
||||
use `UnauthenticatedRateLimitedTransport`.
|
||||
|
||||
The returned `Response.Rate` value contains the rate limit information
|
||||
from the most recent API call. If a recent enough response isn't
|
||||
available, you can use `RateLimits` to fetch the most up-to-date rate
|
||||
limit data for the client.
|
||||
|
||||
To detect an API rate limit error, you can check if its type is `*github.RateLimitError`:
|
||||
|
||||
```go
|
||||
repos, _, err := client.Repositories.List(ctx, "", nil)
|
||||
if _, ok := err.(*github.RateLimitError); ok {
|
||||
log.Println("hit rate limit")
|
||||
}
|
||||
```
|
||||
|
||||
Learn more about GitHub rate limiting at
|
||||
https://developer.github.com/v3/#rate-limiting.
|
||||
|
||||
### Accepted Status ###
|
||||
|
||||
Some endpoints may return a 202 Accepted status code, meaning that the
|
||||
information required is not yet ready and was scheduled to be gathered on
|
||||
the GitHub side. Methods known to behave like this are documented specifying
|
||||
this behavior.
|
||||
|
||||
To detect this condition of error, you can check if its type is
|
||||
`*github.AcceptedError`:
|
||||
|
||||
```go
|
||||
stats, _, err := client.Repositories.ListContributorsStats(ctx, org, repo)
|
||||
if _, ok := err.(*github.AcceptedError); ok {
|
||||
log.Println("scheduled on GitHub side")
|
||||
}
|
||||
```
|
||||
|
||||
### Conditional Requests ###
|
||||
|
||||
The GitHub API has good support for conditional requests which will help
|
||||
prevent you from burning through your rate limit, as well as help speed up your
|
||||
application. `go-github` does not handle conditional requests directly, but is
|
||||
instead designed to work with a caching `http.Transport`. We recommend using
|
||||
https://github.com/gregjones/httpcache for that.
|
||||
|
||||
Learn more about GitHub conditional requests at
|
||||
https://developer.github.com/v3/#conditional-requests.
|
||||
|
||||
### Creating and Updating Resources ###
|
||||
|
||||
All structs for GitHub resources use pointer values for all non-repeated fields.
|
||||
This allows distinguishing between unset fields and those set to a zero-value.
|
||||
Helper functions have been provided to easily create these pointers for string,
|
||||
bool, and int values. For example:
|
||||
|
||||
```go
|
||||
// create a new private repository named "foo"
|
||||
repo := &github.Repository{
|
||||
Name: github.String("foo"),
|
||||
Private: github.Bool(true),
|
||||
}
|
||||
client.Repositories.Create(ctx, "", repo)
|
||||
```
|
||||
|
||||
Users who have worked with protocol buffers should find this pattern familiar.
|
||||
|
||||
### Pagination ###
|
||||
|
||||
All requests for resource collections (repos, pull requests, issues, etc.)
|
||||
support pagination. Pagination options are described in the
|
||||
`github.ListOptions` struct and passed to the list methods directly or as an
|
||||
embedded type of a more specific list options struct (for example
|
||||
`github.PullRequestListOptions`). Pages information is available via the
|
||||
`github.Response` struct.
|
||||
|
||||
```go
|
||||
client := github.NewClient(nil)
|
||||
|
||||
opt := &github.RepositoryListByOrgOptions{
|
||||
ListOptions: github.ListOptions{PerPage: 10},
|
||||
}
|
||||
// get all pages of results
|
||||
var allRepos []*github.Repository
|
||||
for {
|
||||
repos, resp, err := client.Repositories.ListByOrg(ctx, "github", opt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
allRepos = append(allRepos, repos...)
|
||||
if resp.NextPage == 0 {
|
||||
break
|
||||
}
|
||||
opt.Page = resp.NextPage
|
||||
}
|
||||
```
|
||||
|
||||
For complete usage of go-github, see the full [package docs][].
|
||||
|
||||
[GitHub API v3]: https://developer.github.com/v3/
|
||||
[oauth2]: https://github.com/golang/oauth2
|
||||
[oauth2 docs]: https://godoc.org/golang.org/x/oauth2
|
||||
[personal API token]: https://github.com/blog/1509-personal-api-tokens
|
||||
[package docs]: https://godoc.org/github.com/google/go-github/github
|
||||
[GraphQL API v4]: https://developer.github.com/v4/
|
||||
[shurcooL/githubql]: https://github.com/shurcooL/githubql
|
||||
|
||||
### Google App Engine ###
|
||||
|
||||
Go on App Engine Classic (which as of this writing uses Go 1.6) can not use
|
||||
the `"context"` import and still relies on `"golang.org/x/net/context"`.
|
||||
As a result, if you wish to continue to use `go-github` on App Engine Classic,
|
||||
you will need to rewrite all the `"context"` imports using the following command:
|
||||
|
||||
gofmt -w -r '"context" -> "golang.org/x/net/context"' *.go
|
||||
|
||||
See `with_appengine.go` for more details.
|
||||
|
||||
### Integration Tests ###
|
||||
|
||||
You can run integration tests from the `test` directory. See the integration tests [README](test/README.md).
|
||||
|
||||
## Roadmap ##
|
||||
|
||||
This library is being initially developed for an internal application at
|
||||
Google, so API methods will likely be implemented in the order that they are
|
||||
needed by that application. You can track the status of implementation in
|
||||
[this Google spreadsheet][roadmap]. Eventually, I would like to cover the entire
|
||||
GitHub API, so contributions are of course [always welcome][contributing]. The
|
||||
calling pattern is pretty well established, so adding new methods is relatively
|
||||
straightforward.
|
||||
|
||||
[roadmap]: https://docs.google.com/spreadsheet/ccc?key=0ApoVX4GOiXr-dGNKN1pObFh6ek1DR2FKUjBNZ1FmaEE&usp=sharing
|
||||
[contributing]: CONTRIBUTING.md
|
||||
|
||||
## License ##
|
||||
|
||||
This library is distributed under the BSD-style license found in the [LICENSE](./LICENSE)
|
||||
file.
|
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2013 Google. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1 @@
|
|||
.DS_Store
|
|
@ -0,0 +1,3 @@
|
|||
language: go
|
||||
go: 1.3
|
||||
script: go test ./...
|
|
@ -0,0 +1,4 @@
|
|||
.db
|
||||
*.test
|
||||
*~
|
||||
*.swp
|
|
@ -0,0 +1,73 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
client_configure() {
|
||||
sudo chmod 600 $PQSSLCERTTEST_PATH/postgresql.key
|
||||
}
|
||||
|
||||
pgdg_repository() {
|
||||
local sourcelist='sources.list.d/postgresql.list'
|
||||
|
||||
curl -sS 'https://www.postgresql.org/media/keys/ACCC4CF8.asc' | sudo apt-key add -
|
||||
echo deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main $PGVERSION | sudo tee "/etc/apt/$sourcelist"
|
||||
sudo apt-get -o Dir::Etc::sourcelist="$sourcelist" -o Dir::Etc::sourceparts='-' -o APT::Get::List-Cleanup='0' update
|
||||
}
|
||||
|
||||
postgresql_configure() {
|
||||
sudo tee /etc/postgresql/$PGVERSION/main/pg_hba.conf > /dev/null <<-config
|
||||
local all all trust
|
||||
hostnossl all pqgossltest 127.0.0.1/32 reject
|
||||
hostnossl all pqgosslcert 127.0.0.1/32 reject
|
||||
hostssl all pqgossltest 127.0.0.1/32 trust
|
||||
hostssl all pqgosslcert 127.0.0.1/32 cert
|
||||
host all all 127.0.0.1/32 trust
|
||||
hostnossl all pqgossltest ::1/128 reject
|
||||
hostnossl all pqgosslcert ::1/128 reject
|
||||
hostssl all pqgossltest ::1/128 trust
|
||||
hostssl all pqgosslcert ::1/128 cert
|
||||
host all all ::1/128 trust
|
||||
config
|
||||
|
||||
xargs sudo install -o postgres -g postgres -m 600 -t /var/lib/postgresql/$PGVERSION/main/ <<-certificates
|
||||
certs/root.crt
|
||||
certs/server.crt
|
||||
certs/server.key
|
||||
certificates
|
||||
|
||||
sort -VCu <<-versions ||
|
||||
$PGVERSION
|
||||
9.2
|
||||
versions
|
||||
sudo tee -a /etc/postgresql/$PGVERSION/main/postgresql.conf > /dev/null <<-config
|
||||
ssl_ca_file = 'root.crt'
|
||||
ssl_cert_file = 'server.crt'
|
||||
ssl_key_file = 'server.key'
|
||||
config
|
||||
|
||||
echo 127.0.0.1 postgres | sudo tee -a /etc/hosts > /dev/null
|
||||
|
||||
sudo service postgresql restart
|
||||
}
|
||||
|
||||
postgresql_install() {
|
||||
xargs sudo apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confnew' install <<-packages
|
||||
postgresql-$PGVERSION
|
||||
postgresql-server-dev-$PGVERSION
|
||||
postgresql-contrib-$PGVERSION
|
||||
packages
|
||||
}
|
||||
|
||||
postgresql_uninstall() {
|
||||
sudo service postgresql stop
|
||||
xargs sudo apt-get -y --purge remove <<-packages
|
||||
libpq-dev
|
||||
libpq5
|
||||
postgresql
|
||||
postgresql-client-common
|
||||
postgresql-common
|
||||
packages
|
||||
sudo rm -rf /var/lib/postgresql
|
||||
}
|
||||
|
||||
$1
|
|
@ -0,0 +1,43 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.5
|
||||
- 1.6
|
||||
- 1.7
|
||||
- tip
|
||||
|
||||
sudo: true
|
||||
|
||||
env:
|
||||
global:
|
||||
- PGUSER=postgres
|
||||
- PQGOSSLTESTS=1
|
||||
- PQSSLCERTTEST_PATH=$PWD/certs
|
||||
- PGHOST=127.0.0.1
|
||||
matrix:
|
||||
- PGVERSION=9.5
|
||||
- PGVERSION=9.4
|
||||
- PGVERSION=9.3
|
||||
- PGVERSION=9.2
|
||||
- PGVERSION=9.1
|
||||
- PGVERSION=9.0
|
||||
|
||||
before_install:
|
||||
- ./.travis.sh postgresql_uninstall
|
||||
- ./.travis.sh pgdg_repository
|
||||
- ./.travis.sh postgresql_install
|
||||
- ./.travis.sh postgresql_configure
|
||||
- ./.travis.sh client_configure
|
||||
- go get golang.org/x/tools/cmd/goimports
|
||||
|
||||
before_script:
|
||||
- createdb pqgotest
|
||||
- createuser -DRS pqgossltest
|
||||
- createuser -DRS pqgosslcert
|
||||
|
||||
script:
|
||||
- >
|
||||
goimports -d -e $(find -name '*.go') | awk '{ print } END { exit NR == 0 ? 0 : 1 }'
|
||||
- go vet ./...
|
||||
- PQTEST_BINARY_PARAMETERS=no go test -v ./...
|
||||
- PQTEST_BINARY_PARAMETERS=yes go test -v ./...
|
|
@ -1,74 +0,0 @@
|
|||
// +build ignore
|
||||
|
||||
// Generate the table of OID values
|
||||
// Run with 'go run gen.go'.
|
||||
package main
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
)
|
||||
|
||||
func main() {
|
||||
datname := os.Getenv("PGDATABASE")
|
||||
sslmode := os.Getenv("PGSSLMODE")
|
||||
|
||||
if datname == "" {
|
||||
os.Setenv("PGDATABASE", "pqgotest")
|
||||
}
|
||||
|
||||
if sslmode == "" {
|
||||
os.Setenv("PGSSLMODE", "disable")
|
||||
}
|
||||
|
||||
db, err := sql.Open("postgres", "")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
cmd := exec.Command("gofmt")
|
||||
cmd.Stderr = os.Stderr
|
||||
w, err := cmd.StdinPipe()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
f, err := os.Create("types.go")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
cmd.Stdout = f
|
||||
err = cmd.Start()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Fprintln(w, "// generated by 'go run gen.go'; do not edit")
|
||||
fmt.Fprintln(w, "\npackage oid")
|
||||
fmt.Fprintln(w, "const (")
|
||||
rows, err := db.Query(`
|
||||
SELECT typname, oid
|
||||
FROM pg_type WHERE oid < 10000
|
||||
ORDER BY oid;
|
||||
`)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
var name string
|
||||
var oid int
|
||||
for rows.Next() {
|
||||
err = rows.Scan(&name, &oid)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Fprintf(w, "T_%s Oid = %d\n", name, oid)
|
||||
}
|
||||
if err = rows.Err(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Fprintln(w, ")")
|
||||
w.Close()
|
||||
cmd.Wait()
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
language: go
|
||||
sudo: false
|
||||
go:
|
||||
- 1.3
|
||||
- 1.4
|
||||
- tip
|
|
@ -1,43 +0,0 @@
|
|||
# go-colorable
|
||||
|
||||
Colorable writer for windows.
|
||||
|
||||
For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.)
|
||||
This package is possible to handle escape sequence for ansi color on windows.
|
||||
|
||||
## Too Bad!
|
||||
|
||||
![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png)
|
||||
|
||||
|
||||
## So Good!
|
||||
|
||||
![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png)
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})
|
||||
logrus.SetOutput(colorable.NewColorableStdout())
|
||||
|
||||
logrus.Info("succeeded")
|
||||
logrus.Warn("not correct")
|
||||
logrus.Error("something error")
|
||||
logrus.Fatal("panic")
|
||||
```
|
||||
|
||||
You can compile above code on non-windows OSs.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ go get github.com/mattn/go-colorable
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
MIT
|
||||
|
||||
# Author
|
||||
|
||||
Yasuhiro Matsumoto (a.k.a mattn)
|
|
@ -1,16 +0,0 @@
|
|||
// +build !windows
|
||||
|
||||
package colorable
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
func NewColorableStdout() io.Writer {
|
||||
return os.Stdout
|
||||
}
|
||||
|
||||
func NewColorableStderr() io.Writer {
|
||||
return os.Stderr
|
||||
}
|
|
@ -1,665 +0,0 @@
|
|||
package colorable
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/mattn/go-isatty"
|
||||
)
|
||||
|
||||
const (
|
||||
foregroundBlue = 0x1
|
||||
foregroundGreen = 0x2
|
||||
foregroundRed = 0x4
|
||||
foregroundIntensity = 0x8
|
||||
foregroundMask = (foregroundRed | foregroundBlue | foregroundGreen | foregroundIntensity)
|
||||
backgroundBlue = 0x10
|
||||
backgroundGreen = 0x20
|
||||
backgroundRed = 0x40
|
||||
backgroundIntensity = 0x80
|
||||
backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity)
|
||||
)
|
||||
|
||||
type wchar uint16
|
||||
type short int16
|
||||
type dword uint32
|
||||
type word uint16
|
||||
|
||||
type coord struct {
|
||||
x short
|
||||
y short
|
||||
}
|
||||
|
||||
type smallRect struct {
|
||||
left short
|
||||
top short
|
||||
right short
|
||||
bottom short
|
||||
}
|
||||
|
||||
type consoleScreenBufferInfo struct {
|
||||
size coord
|
||||
cursorPosition coord
|
||||
attributes word
|
||||
window smallRect
|
||||
maximumWindowSize coord
|
||||
}
|
||||
|
||||
var (
|
||||
kernel32 = syscall.NewLazyDLL("kernel32.dll")
|
||||
procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
|
||||
procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute")
|
||||
)
|
||||
|
||||
type Writer struct {
|
||||
out io.Writer
|
||||
handle syscall.Handle
|
||||
lastbuf bytes.Buffer
|
||||
oldattr word
|
||||
}
|
||||
|
||||
func NewColorableStdout() io.Writer {
|
||||
var csbi consoleScreenBufferInfo
|
||||
out := os.Stdout
|
||||
if !isatty.IsTerminal(out.Fd()) {
|
||||
return out
|
||||
}
|
||||
handle := syscall.Handle(out.Fd())
|
||||
procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
|
||||
return &Writer{out: out, handle: handle, oldattr: csbi.attributes}
|
||||
}
|
||||
|
||||
func NewColorableStderr() io.Writer {
|
||||
var csbi consoleScreenBufferInfo
|
||||
out := os.Stderr
|
||||
if !isatty.IsTerminal(out.Fd()) {
|
||||
return out
|
||||
}
|
||||
handle := syscall.Handle(out.Fd())
|
||||
procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
|
||||
return &Writer{out: out, handle: handle, oldattr: csbi.attributes}
|
||||
}
|
||||
|
||||
var color256 = map[int]int{
|
||||
0: 0x000000,
|
||||
1: 0x800000,
|
||||
2: 0x008000,
|
||||
3: 0x808000,
|
||||
4: 0x000080,
|
||||
5: 0x800080,
|
||||
6: 0x008080,
|
||||
7: 0xc0c0c0,
|
||||
8: 0x808080,
|
||||
9: 0xff0000,
|
||||
10: 0x00ff00,
|
||||
11: 0xffff00,
|
||||
12: 0x0000ff,
|
||||
13: 0xff00ff,
|
||||
14: 0x00ffff,
|
||||
15: 0xffffff,
|
||||
16: 0x000000,
|
||||
17: 0x00005f,
|
||||
18: 0x000087,
|
||||
19: 0x0000af,
|
||||
20: 0x0000d7,
|
||||
21: 0x0000ff,
|
||||
22: 0x005f00,
|
||||
23: 0x005f5f,
|
||||
24: 0x005f87,
|
||||
25: 0x005faf,
|
||||
26: 0x005fd7,
|
||||
27: 0x005fff,
|
||||
28: 0x008700,
|
||||
29: 0x00875f,
|
||||
30: 0x008787,
|
||||
31: 0x0087af,
|
||||
32: 0x0087d7,
|
||||
33: 0x0087ff,
|
||||
34: 0x00af00,
|
||||
35: 0x00af5f,
|
||||
36: 0x00af87,
|
||||
37: 0x00afaf,
|
||||
38: 0x00afd7,
|
||||
39: 0x00afff,
|
||||
40: 0x00d700,
|
||||
41: 0x00d75f,
|
||||
42: 0x00d787,
|
||||
43: 0x00d7af,
|
||||
44: 0x00d7d7,
|
||||
45: 0x00d7ff,
|
||||
46: 0x00ff00,
|
||||
47: 0x00ff5f,
|
||||
48: 0x00ff87,
|
||||
49: 0x00ffaf,
|
||||
50: 0x00ffd7,
|
||||
51: 0x00ffff,
|
||||
52: 0x5f0000,
|
||||
53: 0x5f005f,
|
||||
54: 0x5f0087,
|
||||
55: 0x5f00af,
|
||||
56: 0x5f00d7,
|
||||
57: 0x5f00ff,
|
||||
58: 0x5f5f00,
|
||||
59: 0x5f5f5f,
|
||||
60: 0x5f5f87,
|
||||
61: 0x5f5faf,
|
||||
62: 0x5f5fd7,
|
||||
63: 0x5f5fff,
|
||||
64: 0x5f8700,
|
||||
65: 0x5f875f,
|
||||
66: 0x5f8787,
|
||||
67: 0x5f87af,
|
||||
68: 0x5f87d7,
|
||||
69: 0x5f87ff,
|
||||
70: 0x5faf00,
|
||||
71: 0x5faf5f,
|
||||
72: 0x5faf87,
|
||||
73: 0x5fafaf,
|
||||
74: 0x5fafd7,
|
||||
75: 0x5fafff,
|
||||
76: 0x5fd700,
|
||||
77: 0x5fd75f,
|
||||
78: 0x5fd787,
|
||||
79: 0x5fd7af,
|
||||
80: 0x5fd7d7,
|
||||
81: 0x5fd7ff,
|
||||
82: 0x5fff00,
|
||||
83: 0x5fff5f,
|
||||
84: 0x5fff87,
|
||||
85: 0x5fffaf,
|
||||
86: 0x5fffd7,
|
||||
87: 0x5fffff,
|
||||
88: 0x870000,
|
||||
89: 0x87005f,
|
||||
90: 0x870087,
|
||||
91: 0x8700af,
|
||||
92: 0x8700d7,
|
||||
93: 0x8700ff,
|
||||
94: 0x875f00,
|
||||
95: 0x875f5f,
|
||||
96: 0x875f87,
|
||||
97: 0x875faf,
|
||||
98: 0x875fd7,
|
||||
99: 0x875fff,
|
||||
100: 0x878700,
|
||||
101: 0x87875f,
|
||||
102: 0x878787,
|
||||
103: 0x8787af,
|
||||
104: 0x8787d7,
|
||||
105: 0x8787ff,
|
||||
106: 0x87af00,
|
||||
107: 0x87af5f,
|
||||
108: 0x87af87,
|
||||
109: 0x87afaf,
|
||||
110: 0x87afd7,
|
||||
111: 0x87afff,
|
||||
112: 0x87d700,
|
||||
113: 0x87d75f,
|
||||
114: 0x87d787,
|
||||
115: 0x87d7af,
|
||||
116: 0x87d7d7,
|
||||
117: 0x87d7ff,
|
||||
118: 0x87ff00,
|
||||
119: 0x87ff5f,
|
||||
120: 0x87ff87,
|
||||
121: 0x87ffaf,
|
||||
122: 0x87ffd7,
|
||||
123: 0x87ffff,
|
||||
124: 0xaf0000,
|
||||
125: 0xaf005f,
|
||||
126: 0xaf0087,
|
||||
127: 0xaf00af,
|
||||
128: 0xaf00d7,
|
||||
129: 0xaf00ff,
|
||||
130: 0xaf5f00,
|
||||
131: 0xaf5f5f,
|
||||
132: 0xaf5f87,
|
||||
133: 0xaf5faf,
|
||||
134: 0xaf5fd7,
|
||||
135: 0xaf5fff,
|
||||
136: 0xaf8700,
|
||||
137: 0xaf875f,
|
||||
138: 0xaf8787,
|
||||
139: 0xaf87af,
|
||||
140: 0xaf87d7,
|
||||
141: 0xaf87ff,
|
||||
142: 0xafaf00,
|
||||
143: 0xafaf5f,
|
||||
144: 0xafaf87,
|
||||
145: 0xafafaf,
|
||||
146: 0xafafd7,
|
||||
147: 0xafafff,
|
||||
148: 0xafd700,
|
||||
149: 0xafd75f,
|
||||
150: 0xafd787,
|
||||
151: 0xafd7af,
|
||||
152: 0xafd7d7,
|
||||
153: 0xafd7ff,
|
||||
154: 0xafff00,
|
||||
155: 0xafff5f,
|
||||
156: 0xafff87,
|
||||
157: 0xafffaf,
|
||||
158: 0xafffd7,
|
||||
159: 0xafffff,
|
||||
160: 0xd70000,
|
||||
161: 0xd7005f,
|
||||
162: 0xd70087,
|
||||
163: 0xd700af,
|
||||
164: 0xd700d7,
|
||||
165: 0xd700ff,
|
||||
166: 0xd75f00,
|
||||
167: 0xd75f5f,
|
||||
168: 0xd75f87,
|
||||
169: 0xd75faf,
|
||||
170: 0xd75fd7,
|
||||
171: 0xd75fff,
|
||||
172: 0xd78700,
|
||||
173: 0xd7875f,
|
||||
174: 0xd78787,
|
||||
175: 0xd787af,
|
||||
176: 0xd787d7,
|
||||
177: 0xd787ff,
|
||||
178: 0xd7af00,
|
||||
179: 0xd7af5f,
|
||||
180: 0xd7af87,
|
||||
181: 0xd7afaf,
|
||||
182: 0xd7afd7,
|
||||
183: 0xd7afff,
|
||||
184: 0xd7d700,
|
||||
185: 0xd7d75f,
|
||||
186: 0xd7d787,
|
||||
187: 0xd7d7af,
|
||||
188: 0xd7d7d7,
|
||||
189: 0xd7d7ff,
|
||||
190: 0xd7ff00,
|
||||
191: 0xd7ff5f,
|
||||
192: 0xd7ff87,
|
||||
193: 0xd7ffaf,
|
||||
194: 0xd7ffd7,
|
||||
195: 0xd7ffff,
|
||||
196: 0xff0000,
|
||||
197: 0xff005f,
|
||||
198: 0xff0087,
|
||||
199: 0xff00af,
|
||||
200: 0xff00d7,
|
||||
201: 0xff00ff,
|
||||
202: 0xff5f00,
|
||||
203: 0xff5f5f,
|
||||
204: 0xff5f87,
|
||||
205: 0xff5faf,
|
||||
206: 0xff5fd7,
|
||||
207: 0xff5fff,
|
||||
208: 0xff8700,
|
||||
209: 0xff875f,
|
||||
210: 0xff8787,
|
||||
211: 0xff87af,
|
||||
212: 0xff87d7,
|
||||
213: 0xff87ff,
|
||||
214: 0xffaf00,
|
||||
215: 0xffaf5f,
|
||||
216: 0xffaf87,
|
||||
217: 0xffafaf,
|
||||
218: 0xffafd7,
|
||||
219: 0xffafff,
|
||||
220: 0xffd700,
|
||||
221: 0xffd75f,
|
||||
222: 0xffd787,
|
||||
223: 0xffd7af,
|
||||
224: 0xffd7d7,
|
||||
225: 0xffd7ff,
|
||||
226: 0xffff00,
|
||||
227: 0xffff5f,
|
||||
228: 0xffff87,
|
||||
229: 0xffffaf,
|
||||
230: 0xffffd7,
|
||||
231: 0xffffff,
|
||||
232: 0x080808,
|
||||
233: 0x121212,
|
||||
234: 0x1c1c1c,
|
||||
235: 0x262626,
|
||||
236: 0x303030,
|
||||
237: 0x3a3a3a,
|
||||
238: 0x444444,
|
||||
239: 0x4e4e4e,
|
||||
240: 0x585858,
|
||||
241: 0x626262,
|
||||
242: 0x6c6c6c,
|
||||
243: 0x767676,
|
||||
244: 0x808080,
|
||||
245: 0x8a8a8a,
|
||||
246: 0x949494,
|
||||
247: 0x9e9e9e,
|
||||
248: 0xa8a8a8,
|
||||
249: 0xb2b2b2,
|
||||
250: 0xbcbcbc,
|
||||
251: 0xc6c6c6,
|
||||
252: 0xd0d0d0,
|
||||
253: 0xdadada,
|
||||
254: 0xe4e4e4,
|
||||
255: 0xeeeeee,
|
||||
}
|
||||
|
||||
func (w *Writer) Write(data []byte) (n int, err error) {
|
||||
var csbi consoleScreenBufferInfo
|
||||
procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
|
||||
|
||||
er := bytes.NewBuffer(data)
|
||||
loop:
|
||||
for {
|
||||
r1, _, err := procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
|
||||
if r1 == 0 {
|
||||
break loop
|
||||
}
|
||||
|
||||
c1, _, err := er.ReadRune()
|
||||
if err != nil {
|
||||
break loop
|
||||
}
|
||||
if c1 != 0x1b {
|
||||
fmt.Fprint(w.out, string(c1))
|
||||
continue
|
||||
}
|
||||
c2, _, err := er.ReadRune()
|
||||
if err != nil {
|
||||
w.lastbuf.WriteRune(c1)
|
||||
break loop
|
||||
}
|
||||
if c2 != 0x5b {
|
||||
w.lastbuf.WriteRune(c1)
|
||||
w.lastbuf.WriteRune(c2)
|
||||
continue
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
var m rune
|
||||
for {
|
||||
c, _, err := er.ReadRune()
|
||||
if err != nil {
|
||||
w.lastbuf.WriteRune(c1)
|
||||
w.lastbuf.WriteRune(c2)
|
||||
w.lastbuf.Write(buf.Bytes())
|
||||
break loop
|
||||
}
|
||||
if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' {
|
||||
m = c
|
||||
break
|
||||
}
|
||||
buf.Write([]byte(string(c)))
|
||||
}
|
||||
|
||||
switch m {
|
||||
case 'm':
|
||||
attr := csbi.attributes
|
||||
cs := buf.String()
|
||||
if cs == "" {
|
||||
procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(w.oldattr))
|
||||
continue
|
||||
}
|
||||
token := strings.Split(cs, ";")
|
||||
for i := 0; i < len(token); i += 1 {
|
||||
ns := token[i]
|
||||
if n, err = strconv.Atoi(ns); err == nil {
|
||||
switch {
|
||||
case n == 0 || n == 100:
|
||||
attr = w.oldattr
|
||||
case 1 <= n && n <= 5:
|
||||
attr |= foregroundIntensity
|
||||
case n == 7:
|
||||
attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
|
||||
case 22 == n || n == 25 || n == 25:
|
||||
attr |= foregroundIntensity
|
||||
case n == 27:
|
||||
attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
|
||||
case 30 <= n && n <= 37:
|
||||
attr = (attr & backgroundMask)
|
||||
if (n-30)&1 != 0 {
|
||||
attr |= foregroundRed
|
||||
}
|
||||
if (n-30)&2 != 0 {
|
||||
attr |= foregroundGreen
|
||||
}
|
||||
if (n-30)&4 != 0 {
|
||||
attr |= foregroundBlue
|
||||
}
|
||||
case n == 38: // set foreground color.
|
||||
if i < len(token)-2 && (token[i+1] == "5" || token[i+1] == "05") {
|
||||
if n256, err := strconv.Atoi(token[i+2]); err == nil {
|
||||
if n256foreAttr == nil {
|
||||
n256setup()
|
||||
}
|
||||
attr &= backgroundMask
|
||||
attr |= n256foreAttr[n256]
|
||||
i += 2
|
||||
}
|
||||
} else {
|
||||
attr = attr & (w.oldattr & backgroundMask)
|
||||
}
|
||||
case n == 39: // reset foreground color.
|
||||
attr &= backgroundMask
|
||||
attr |= w.oldattr & foregroundMask
|
||||
case 40 <= n && n <= 47:
|
||||
attr = (attr & foregroundMask)
|
||||
if (n-40)&1 != 0 {
|
||||
attr |= backgroundRed
|
||||
}
|
||||
if (n-40)&2 != 0 {
|
||||
attr |= backgroundGreen
|
||||
}
|
||||
if (n-40)&4 != 0 {
|
||||
attr |= backgroundBlue
|
||||
}
|
||||
case n == 48: // set background color.
|
||||
if i < len(token)-2 && token[i+1] == "5" {
|
||||
if n256, err := strconv.Atoi(token[i+2]); err == nil {
|
||||
if n256backAttr == nil {
|
||||
n256setup()
|
||||
}
|
||||
attr &= foregroundMask
|
||||
attr |= n256backAttr[n256]
|
||||
i += 2
|
||||
}
|
||||
} else {
|
||||
attr = attr & (w.oldattr & foregroundMask)
|
||||
}
|
||||
case n == 49: // reset foreground color.
|
||||
attr &= foregroundMask
|
||||
attr |= w.oldattr & backgroundMask
|
||||
case 90 <= n && n <= 97:
|
||||
attr = (attr & backgroundMask)
|
||||
attr |= foregroundIntensity
|
||||
if (n-90)&1 != 0 {
|
||||
attr |= foregroundRed
|
||||
}
|
||||
if (n-90)&2 != 0 {
|
||||
attr |= foregroundGreen
|
||||
}
|
||||
if (n-90)&4 != 0 {
|
||||
attr |= foregroundBlue
|
||||
}
|
||||
case 100 <= n && n <= 107:
|
||||
attr = (attr & foregroundMask)
|
||||
attr |= backgroundIntensity
|
||||
if (n-100)&1 != 0 {
|
||||
attr |= backgroundRed
|
||||
}
|
||||
if (n-100)&2 != 0 {
|
||||
attr |= backgroundGreen
|
||||
}
|
||||
if (n-100)&4 != 0 {
|
||||
attr |= backgroundBlue
|
||||
}
|
||||
}
|
||||
procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(attr))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return len(data) - w.lastbuf.Len(), nil
|
||||
}
|
||||
|
||||
type consoleColor struct {
|
||||
rgb int
|
||||
red bool
|
||||
green bool
|
||||
blue bool
|
||||
intensity bool
|
||||
}
|
||||
|
||||
func (c consoleColor) foregroundAttr() (attr word) {
|
||||
if c.red {
|
||||
attr |= foregroundRed
|
||||
}
|
||||
if c.green {
|
||||
attr |= foregroundGreen
|
||||
}
|
||||
if c.blue {
|
||||
attr |= foregroundBlue
|
||||
}
|
||||
if c.intensity {
|
||||
attr |= foregroundIntensity
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c consoleColor) backgroundAttr() (attr word) {
|
||||
if c.red {
|
||||
attr |= backgroundRed
|
||||
}
|
||||
if c.green {
|
||||
attr |= backgroundGreen
|
||||
}
|
||||
if c.blue {
|
||||
attr |= backgroundBlue
|
||||
}
|
||||
if c.intensity {
|
||||
attr |= backgroundIntensity
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var color16 = []consoleColor{
|
||||
consoleColor{0x000000, false, false, false, false},
|
||||
consoleColor{0x000080, false, false, true, false},
|
||||
consoleColor{0x008000, false, true, false, false},
|
||||
consoleColor{0x008080, false, true, true, false},
|
||||
consoleColor{0x800000, true, false, false, false},
|
||||
consoleColor{0x800080, true, false, true, false},
|
||||
consoleColor{0x808000, true, true, false, false},
|
||||
consoleColor{0xc0c0c0, true, true, true, false},
|
||||
consoleColor{0x808080, false, false, false, true},
|
||||
consoleColor{0x0000ff, false, false, true, true},
|
||||
consoleColor{0x00ff00, false, true, false, true},
|
||||
consoleColor{0x00ffff, false, true, true, true},
|
||||
consoleColor{0xff0000, true, false, false, true},
|
||||
consoleColor{0xff00ff, true, false, true, true},
|
||||
consoleColor{0xffff00, true, true, false, true},
|
||||
consoleColor{0xffffff, true, true, true, true},
|
||||
}
|
||||
|
||||
type hsv struct {
|
||||
h, s, v float32
|
||||
}
|
||||
|
||||
func (a hsv) dist(b hsv) float32 {
|
||||
dh := a.h - b.h
|
||||
switch {
|
||||
case dh > 0.5:
|
||||
dh = 1 - dh
|
||||
case dh < -0.5:
|
||||
dh = -1 - dh
|
||||
}
|
||||
ds := a.s - b.s
|
||||
dv := a.v - b.v
|
||||
return float32(math.Sqrt(float64(dh*dh + ds*ds + dv*dv)))
|
||||
}
|
||||
|
||||
func toHSV(rgb int) hsv {
|
||||
r, g, b := float32((rgb&0xFF0000)>>16)/256.0,
|
||||
float32((rgb&0x00FF00)>>8)/256.0,
|
||||
float32(rgb&0x0000FF)/256.0
|
||||
min, max := minmax3f(r, g, b)
|
||||
h := max - min
|
||||
if h > 0 {
|
||||
if max == r {
|
||||
h = (g - b) / h
|
||||
if h < 0 {
|
||||
h += 6
|
||||
}
|
||||
} else if max == g {
|
||||
h = 2 + (b-r)/h
|
||||
} else {
|
||||
h = 4 + (r-g)/h
|
||||
}
|
||||
}
|
||||
h /= 6.0
|
||||
s := max - min
|
||||
if max != 0 {
|
||||
s /= max
|
||||
}
|
||||
v := max
|
||||
return hsv{h: h, s: s, v: v}
|
||||
}
|
||||
|
||||
type hsvTable []hsv
|
||||
|
||||
func toHSVTable(rgbTable []consoleColor) hsvTable {
|
||||
t := make(hsvTable, len(rgbTable))
|
||||
for i, c := range rgbTable {
|
||||
t[i] = toHSV(c.rgb)
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
func (t hsvTable) find(rgb int) consoleColor {
|
||||
hsv := toHSV(rgb)
|
||||
n := 7
|
||||
l := float32(5.0)
|
||||
for i, p := range t {
|
||||
d := hsv.dist(p)
|
||||
if d < l {
|
||||
l, n = d, i
|
||||
}
|
||||
}
|
||||
return color16[n]
|
||||
}
|
||||
|
||||
func minmax3f(a, b, c float32) (min, max float32) {
|
||||
if a < b {
|
||||
if b < c {
|
||||
return a, c
|
||||
} else if a < c {
|
||||
return a, b
|
||||
} else {
|
||||
return c, b
|
||||
}
|
||||
} else {
|
||||
if a < c {
|
||||
return b, c
|
||||
} else if b < c {
|
||||
return b, a
|
||||
} else {
|
||||
return c, a
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var n256foreAttr []word
|
||||
var n256backAttr []word
|
||||
|
||||
func n256setup() {
|
||||
n256foreAttr = make([]word, 256)
|
||||
n256backAttr = make([]word, 256)
|
||||
t := toHSVTable(color16)
|
||||
for i, rgb := range color256 {
|
||||
c := t.find(rgb)
|
||||
n256foreAttr[i] = c.foregroundAttr()
|
||||
n256backAttr[i] = c.backgroundAttr()
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
Copyright (c) Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
|
||||
|
||||
MIT License (Expat)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,37 +0,0 @@
|
|||
# go-isatty
|
||||
|
||||
isatty for golang
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/mattn/go-isatty"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if isatty.IsTerminal(os.Stdout.Fd()) {
|
||||
fmt.Println("Is Terminal")
|
||||
} else {
|
||||
fmt.Println("Is Not Terminal")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ go get github.com/mattn/go-isatty
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
MIT
|
||||
|
||||
# Author
|
||||
|
||||
Yasuhiro Matsumoto (a.k.a mattn)
|
|
@ -1,2 +0,0 @@
|
|||
// Package isatty implements interface to isatty
|
||||
package isatty
|
|
@ -1,17 +0,0 @@
|
|||
// +build darwin freebsd openbsd netbsd
|
||||
|
||||
package isatty
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const ioctlReadTermios = syscall.TIOCGETA
|
||||
|
||||
// IsTerminal return true if the file descriptor is terminal.
|
||||
func IsTerminal(fd uintptr) bool {
|
||||
var termios syscall.Termios
|
||||
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
|
||||
return err == 0
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
// +build linux
|
||||
|
||||
package isatty
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const ioctlReadTermios = syscall.TCGETS
|
||||
|
||||
// IsTerminal return true if the file descriptor is terminal.
|
||||
func IsTerminal(fd uintptr) bool {
|
||||
var termios syscall.Termios
|
||||
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
|
||||
return err == 0
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
// +build windows
|
||||
|
||||
package isatty
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var kernel32 = syscall.NewLazyDLL("kernel32.dll")
|
||||
var procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
|
||||
|
||||
// IsTerminal return true if the file descriptor is terminal.
|
||||
func IsTerminal(fd uintptr) bool {
|
||||
var st uint32
|
||||
r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0)
|
||||
return r != 0 && e == 0
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
*.db
|
||||
*.exe
|
||||
*.dll
|
|
@ -0,0 +1,9 @@
|
|||
language: go
|
||||
go:
|
||||
- tip
|
||||
before_install:
|
||||
- go get github.com/axw/gocov/gocov
|
||||
- go get github.com/mattn/goveralls
|
||||
- go get golang.org/x/tools/cmd/cover
|
||||
script:
|
||||
- $HOME/gopath/bin/goveralls -repotoken 3qJVUE0iQwqnCbmNcDsjYu1nh4J4KIFXx
|
|
@ -0,0 +1,5 @@
|
|||
.*.swp
|
||||
*.test
|
||||
|
||||
/sql-migrate/test.db
|
||||
/test.db
|
|
@ -0,0 +1,25 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.2
|
||||
- 1.3
|
||||
- 1.4
|
||||
- tip
|
||||
|
||||
services:
|
||||
- mysql
|
||||
|
||||
before_install:
|
||||
- mysql -e "CREATE DATABASE IF NOT EXISTS test;" -uroot
|
||||
- psql -c "CREATE DATABASE test;" -U postgres
|
||||
|
||||
install:
|
||||
- go get -t ./...
|
||||
- go install ./...
|
||||
|
||||
script:
|
||||
- go test -v ./...
|
||||
- bash test-integration/postgres.sh
|
||||
- bash test-integration/mysql.sh
|
||||
- bash test-integration/mysql-flag.sh
|
||||
- bash test-integration/sqlite.sh
|
|
@ -0,0 +1 @@
|
|||
*.swp
|
|
@ -0,0 +1,22 @@
|
|||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
|
@ -0,0 +1,3 @@
|
|||
# This source code refers to The Go Authors for copyright purposes.
|
||||
# The master list of authors is in the main Go distribution,
|
||||
# visible at http://tip.golang.org/AUTHORS.
|
|
@ -0,0 +1,3 @@
|
|||
# This source code was written by the Go contributors.
|
||||
# The master list of contributors is in the main Go distribution,
|
||||
# visible at http://tip.golang.org/CONTRIBUTORS.
|
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,22 @@
|
|||
Additional IP Rights Grant (Patents)
|
||||
|
||||
"This implementation" means the copyrightable works distributed by
|
||||
Google as part of the Go project.
|
||||
|
||||
Google hereby grants to You a perpetual, worldwide, non-exclusive,
|
||||
no-charge, royalty-free, irrevocable (except as stated in this section)
|
||||
patent license to make, have made, use, offer to sell, sell, import,
|
||||
transfer and otherwise run, modify and propagate the contents of this
|
||||
implementation of Go, where such license applies only to those patent
|
||||
claims, both currently owned or controlled by Google and acquired in
|
||||
the future, licensable by Google that are necessarily infringed by this
|
||||
implementation of Go. This grant does not include claims that would be
|
||||
infringed only as a consequence of further modification of this
|
||||
implementation. If you or your agent or exclusive licensee institute or
|
||||
order or agree to the institution of patent litigation against any
|
||||
entity (including a cross-claim or counterclaim in a lawsuit) alleging
|
||||
that this implementation of Go or any code incorporated within this
|
||||
implementation of Go constitutes direct or contributory patent
|
||||
infringement, or inducement of patent infringement, then any patent
|
||||
rights granted to you under this License for this implementation of Go
|
||||
shall terminate as of the date such litigation is filed.
|
|
@ -0,0 +1,14 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.3
|
||||
- 1.4
|
||||
|
||||
install:
|
||||
- export GOPATH="$HOME/gopath"
|
||||
- mkdir -p "$GOPATH/src/golang.org/x"
|
||||
- mv "$TRAVIS_BUILD_DIR" "$GOPATH/src/golang.org/x/oauth2"
|
||||
- go get -v -t -d golang.org/x/oauth2/...
|
||||
|
||||
script:
|
||||
- go test -v golang.org/x/oauth2/...
|
0
vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto
сгенерированный
поставляемый
Executable file → Normal file
0
vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto
сгенерированный
поставляемый
Executable file → Normal file
0
vendor/google.golang.org/appengine/internal/regen.sh
сгенерированный
поставляемый
Executable file → Normal file
0
vendor/google.golang.org/appengine/internal/regen.sh
сгенерированный
поставляемый
Executable file → Normal file
|
@ -1,22 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Dean Karn
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
Package validator
|
||||
================
|
||||
|
||||
[![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[![Build Status](https://semaphoreci.com/api/v1/projects/ec20115f-ef1b-4c7d-9393-cc76aba74eb4/487382/badge.svg)](https://semaphoreci.com/joeybloggs/validator)
|
||||
[![Coverage Status](https://coveralls.io/repos/go-playground/validator/badge.svg?branch=v5)](https://coveralls.io/r/go-playground/validator?branch=v5)
|
||||
[![GoDoc](https://godoc.org/gopkg.in/go-playground/validator.v5?status.svg)](https://godoc.org/gopkg.in/go-playground/validator.v5)
|
||||
|
||||
Package validator implements value validations for structs and individual fields based on tags.
|
||||
|
||||
It has the following **unique** features:
|
||||
|
||||
- Cross Field and Cross Struct validations.
|
||||
- Slice, Array and Map diving, which allows any or all levels of a multidimensional field to be validated.
|
||||
- Handles type interface by determining it's underlying type prior to validation.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Use go get.
|
||||
|
||||
go get gopkg.in/go-playground/validator.v5
|
||||
|
||||
or to update
|
||||
|
||||
go get -u gopkg.in/go-playground/validator.v5
|
||||
|
||||
Then import the validator package into your own code.
|
||||
|
||||
import "gopkg.in/go-playground/validator.v5"
|
||||
|
||||
Usage and documentation
|
||||
------
|
||||
|
||||
Please see http://godoc.org/gopkg.in/go-playground/validator.v5 for detailed usage docs.
|
||||
|
||||
##### Example:
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"gopkg.in/go-playground/validator.v5"
|
||||
)
|
||||
|
||||
// User contains user information
|
||||
type User struct {
|
||||
FirstName string `validate:"required"`
|
||||
LastName string `validate:"required"`
|
||||
Age uint8 `validate:"gte=0,lte=130"`
|
||||
Email string `validate:"required,email"`
|
||||
FavouriteColor string `validate:"hexcolor|rgb|rgba"`
|
||||
Addresses []*Address `validate:"required,dive,required"` // a person can have a home and cottage...
|
||||
}
|
||||
|
||||
// Address houses a users address information
|
||||
type Address struct {
|
||||
Street string `validate:"required"`
|
||||
City string `validate:"required"`
|
||||
Planet string `validate:"required"`
|
||||
Phone string `validate:"required"`
|
||||
}
|
||||
|
||||
var validate *validator.Validate
|
||||
|
||||
func main() {
|
||||
|
||||
validate = validator.New("validate", validator.BakedInValidators)
|
||||
|
||||
address := &Address{
|
||||
Street: "Eavesdown Docks",
|
||||
Planet: "Persphone",
|
||||
Phone: "none",
|
||||
}
|
||||
|
||||
user := &User{
|
||||
FirstName: "Badger",
|
||||
LastName: "Smith",
|
||||
Age: 135,
|
||||
Email: "Badger.Smith@gmail.com",
|
||||
FavouriteColor: "#000",
|
||||
Addresses: []*Address{address},
|
||||
}
|
||||
|
||||
// returns nil or *StructErrors
|
||||
errs := validate.Struct(user)
|
||||
|
||||
if errs != nil {
|
||||
|
||||
// err will be of type *FieldError
|
||||
err := errs.Errors["Age"]
|
||||
fmt.Println(err.Error()) // output: Field validation for "Age" failed on the "lte" tag
|
||||
fmt.Println(err.Field) // output: Age
|
||||
fmt.Println(err.Tag) // output: lte
|
||||
fmt.Println(err.Kind) // output: uint8
|
||||
fmt.Println(err.Type) // output: uint8
|
||||
fmt.Println(err.Param) // output: 130
|
||||
fmt.Println(err.Value) // output: 135
|
||||
|
||||
// or if you prefer you can use the Flatten function
|
||||
// NOTE: I find this usefull when using a more hard static approach of checking field errors.
|
||||
// The above, is best for passing to some generic code to say parse the errors. i.e. I pass errs
|
||||
// to a routine which loops through the errors, creates and translates the error message into the
|
||||
// users locale and returns a map of map[string]string // field and error which I then use
|
||||
// within the HTML rendering.
|
||||
|
||||
flat := errs.Flatten()
|
||||
fmt.Println(flat) // output: map[Age:Field validation for "Age" failed on the "lte" tag Addresses[0].Address.City:Field validation for "City" failed on the "required" tag]
|
||||
err = flat["Addresses[0].Address.City"]
|
||||
fmt.Println(err.Field) // output: City
|
||||
fmt.Println(err.Tag) // output: required
|
||||
fmt.Println(err.Kind) // output: string
|
||||
fmt.Println(err.Type) // output: string
|
||||
fmt.Println(err.Param) // output:
|
||||
fmt.Println(err.Value) // output:
|
||||
|
||||
// from here you can create your own error messages in whatever language you wish
|
||||
return
|
||||
}
|
||||
|
||||
// save user to database
|
||||
}
|
||||
```
|
||||
|
||||
Benchmarks
|
||||
------
|
||||
###### Run on MacBook Pro (Retina, 15-inch, Late 2013) 2.6 GHz Intel Core i7 16 GB 1600 MHz DDR3
|
||||
```go
|
||||
$ go test -cpu=4 -bench=. -benchmem=true
|
||||
PASS
|
||||
BenchmarkValidateField-4 3000000 429 ns/op 192 B/op 2 allocs/op
|
||||
BenchmarkValidateStructSimple-4 500000 2877 ns/op 657 B/op 10 allocs/op
|
||||
BenchmarkTemplateParallelSimple-4 500000 3097 ns/op 657 B/op 10 allocs/op
|
||||
BenchmarkValidateStructLarge-4 100000 15228 ns/op 4350 B/op 62 allocs/op
|
||||
BenchmarkTemplateParallelLarge-4 100000 14257 ns/op 4354 B/op 62 allocs/op
|
||||
```
|
||||
|
||||
How to Contribute
|
||||
------
|
||||
|
||||
There will always be a development branch for each version i.e. `v1-development`. In order to contribute,
|
||||
please make your pull requests against those branches.
|
||||
|
||||
If the changes being proposed or requested are breaking changes, please create an issue, for discussion
|
||||
or create a pull request against the highest development branch for example this package has a
|
||||
v1 and v1-development branch however, there will also be a v2-development brach even though v2 doesn't exist yet.
|
||||
|
||||
I strongly encourage everyone whom creates a custom validation function to contribute them and
|
||||
help make this package even better.
|
||||
|
||||
License
|
||||
------
|
||||
Distributed under MIT License, please see license file in code for more details.
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,483 +0,0 @@
|
|||
/*
|
||||
Package validator implements value validations for structs and individual fields based on tags. It can also handle Cross Field and Cross Struct validation for nested structs.
|
||||
|
||||
Validate
|
||||
|
||||
validate := validator.New("validate", validator.BakedInValidators)
|
||||
|
||||
errs := validate.Struct(//your struct)
|
||||
valErr := validate.Field(field, "omitempty,min=1,max=10")
|
||||
|
||||
A simple example usage:
|
||||
|
||||
type UserDetail struct {
|
||||
Details string `validate:"-"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
Name string `validate:"required,max=60"`
|
||||
PreferedName string `validate:"omitempty,max=60"`
|
||||
Sub UserDetail
|
||||
}
|
||||
|
||||
user := &User {
|
||||
Name: "",
|
||||
}
|
||||
|
||||
// errs will contain a hierarchical list of errors
|
||||
// using the StructErrors struct
|
||||
// or nil if no errors exist
|
||||
errs := validate.Struct(user)
|
||||
|
||||
// in this case 1 error Name is required
|
||||
errs.Struct will be "User"
|
||||
errs.StructErrors will be empty <-- fields that were structs
|
||||
errs.Errors will have 1 error of type FieldError
|
||||
|
||||
NOTE: Anonymous Structs - they don't have names so expect the Struct name
|
||||
within StructErrors to be blank.
|
||||
|
||||
Error Handling
|
||||
|
||||
The error can be used like so
|
||||
|
||||
fieldErr, _ := errs["Name"]
|
||||
fieldErr.Field // "Name"
|
||||
fieldErr.ErrorTag // "required"
|
||||
|
||||
Both StructErrors and FieldError implement the Error interface but it's
|
||||
intended use is for development + debugging, not a production error message.
|
||||
|
||||
fieldErr.Error() // Field validation for "Name" failed on the "required" tag
|
||||
errs.Error()
|
||||
// Struct: User
|
||||
// Field validation for "Name" failed on the "required" tag
|
||||
|
||||
Why not a better error message? because this library intends for you to handle your own error messages
|
||||
|
||||
Why should I handle my own errors? Many reasons, for us building an internationalized application
|
||||
I needed to know the field and what validation failed so that I could provide an error in the users specific language.
|
||||
|
||||
if fieldErr.Field == "Name" {
|
||||
switch fieldErr.ErrorTag
|
||||
case "required":
|
||||
return "Translated string based on field + error"
|
||||
default:
|
||||
return "Translated string based on field"
|
||||
}
|
||||
|
||||
The hierarchical error structure is hard to work with sometimes.. Agreed Flatten function to the rescue!
|
||||
Flatten will return a map of FieldError's but the field name will be namespaced.
|
||||
|
||||
// if UserDetail Details field failed validation
|
||||
Field will be "Sub.Details"
|
||||
|
||||
// for Name
|
||||
Field will be "Name"
|
||||
|
||||
Custom Functions
|
||||
|
||||
Custom functions can be added
|
||||
|
||||
//Structure
|
||||
func customFunc(top interface{}, current interface{}, field interface{}, param string) bool {
|
||||
|
||||
if whatever {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
validate.AddFunction("custom tag name", customFunc)
|
||||
// NOTES: using the same tag name as an existing function
|
||||
// will overwrite the existing one
|
||||
|
||||
Cross Field Validation
|
||||
|
||||
Cross Field Validation can be implemented, for example Start & End Date range validation
|
||||
|
||||
// NOTE: when calling validate.Struct(val) val will be the top level struct passed
|
||||
// into the function
|
||||
// when calling validate.FieldWithValue(val, field, tag) val will be
|
||||
// whatever you pass, struct, field...
|
||||
// when calling validate.Field(field, tag) val will be nil
|
||||
//
|
||||
// Because of the specific requirements and field names within each persons project that
|
||||
// uses this library it is likely that custom functions will need to be created for your
|
||||
// Cross Field Validation needs, however there are some build in Generic Cross Field validations,
|
||||
// see Baked In Validators and Tags below
|
||||
|
||||
func isDateRangeValid(val interface{}, field interface{}, param string) bool {
|
||||
|
||||
myStruct := val.(myStructType)
|
||||
|
||||
if myStruct.Start.After(field.(time.Time)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Multiple Validators
|
||||
|
||||
Multiple validators on a field will process in the order defined
|
||||
|
||||
type Test struct {
|
||||
Field `validate:"max=10,min=1"`
|
||||
}
|
||||
|
||||
// max will be checked then min
|
||||
|
||||
Bad Validator definitions are not handled by the library
|
||||
|
||||
type Test struct {
|
||||
Field `validate:"min=10,max=0"`
|
||||
}
|
||||
|
||||
// this definition of min max will never validate
|
||||
|
||||
Baked In Validators and Tags
|
||||
|
||||
NOTE: Baked In Cross field validation only compares fields on the same struct,
|
||||
if cross field + cross struct validation is needed your own custom validator
|
||||
should be implemented.
|
||||
|
||||
NOTE2: comma is the default separator of validation tags, if you wish to have a comma
|
||||
included within the parameter i.e. excludesall=, you will need to use the UTF-8 hex
|
||||
representation 0x2C, which is replaced in the code as a comma, so the above will
|
||||
become excludesall=0x2C
|
||||
|
||||
Here is a list of the current built in validators:
|
||||
|
||||
-
|
||||
Tells the validation to skip this struct field; this is particularily
|
||||
handy in ignoring embedded structs from being validated. (Usage: -)
|
||||
|
||||
|
|
||||
This is the 'or' operator allowing multiple validators to be used and
|
||||
accepted. (Usage: rbg|rgba) <-- this would allow either rgb or rgba
|
||||
colors to be accepted. This can also be combined with 'and' for example
|
||||
( Usage: omitempty,rgb|rgba)
|
||||
|
||||
structonly
|
||||
When a field that is a nest struct in encountered and contains this flag
|
||||
any validation on the nested struct such as "required" will be run, but
|
||||
none of the nested struct fields will be validated. This is usefull if
|
||||
inside of you program you know the struct will be valid, but need to
|
||||
verify it has been assigned.
|
||||
|
||||
exists
|
||||
Is a special tag without a validation function attached. It is used when a field
|
||||
is a Pointer, Interface or Invalid and you wish to validate that it exists.
|
||||
Example: want to ensure a bool exists if you define the bool as a pointer and
|
||||
use exists it will ensure there is a value; couldn't use required as it would
|
||||
fail when the bool was false. exists will fail is the value is a Pointer, Interface
|
||||
or Invalid and is nil. (Usage: exists)
|
||||
|
||||
omitempty
|
||||
Allows conditional validation, for example if a field is not set with
|
||||
a value (Determined by the required validator) then other validation
|
||||
such as min or max won't run, but if a value is set validation will run.
|
||||
(Usage: omitempty)
|
||||
|
||||
dive
|
||||
This tells the validator to dive into a slice, array or map and validate that
|
||||
level of the slice, array or map with the validation tags that follow.
|
||||
Multidimensional nesting is also supported, each level you wish to dive will
|
||||
require another dive tag. (Usage: dive)
|
||||
Example: [][]string with validation tag "gt=0,dive,len=1,dive,required"
|
||||
gt=0 will be applied to []
|
||||
len=1 will be applied to []string
|
||||
required will be applied to string
|
||||
Example2: [][]string with validation tag "gt=0,dive,dive,required"
|
||||
gt=0 will be applied to []
|
||||
[]string will be spared validation
|
||||
required will be applied to string
|
||||
NOTE: in Example2 if the required validation failed, but all others passed
|
||||
the hierarchy of FieldError's in the middle with have their IsPlaceHolder field
|
||||
set to true. If a FieldError has IsSliceOrMap=true or IsMap=true then the
|
||||
FieldError is a Slice or Map field and if IsPlaceHolder=true then contains errors
|
||||
within its SliceOrArrayErrs or MapErrs fields.
|
||||
|
||||
required
|
||||
This validates that the value is not the data types default zero value.
|
||||
For numbers ensures value is not zero. For strings ensures value is
|
||||
not "". For slices, maps, pointers, interfaces, channels and functions
|
||||
ensures the value is not nil.
|
||||
(Usage: required)
|
||||
|
||||
len
|
||||
For numbers, max will ensure that the value is
|
||||
equal to the parameter given. For strings, it checks that
|
||||
the string length is exactly that number of characters. For slices,
|
||||
arrays, and maps, validates the number of items. (Usage: len=10)
|
||||
|
||||
max
|
||||
For numbers, max will ensure that the value is
|
||||
less than or equal to the parameter given. For strings, it checks
|
||||
that the string length is at most that number of characters. For
|
||||
slices, arrays, and maps, validates the number of items. (Usage: max=10)
|
||||
|
||||
min
|
||||
For numbers, min will ensure that the value is
|
||||
greater or equal to the parameter given. For strings, it checks that
|
||||
the string length is at least that number of characters. For slices,
|
||||
arrays, and maps, validates the number of items. (Usage: min=10)
|
||||
|
||||
eq
|
||||
For strings & numbers, eq will ensure that the value is
|
||||
equal to the parameter given. For slices, arrays, and maps,
|
||||
validates the number of items. (Usage: eq=10)
|
||||
|
||||
ne
|
||||
For strings & numbers, eq will ensure that the value is not
|
||||
equal to the parameter given. For slices, arrays, and maps,
|
||||
validates the number of items. (Usage: eq=10)
|
||||
|
||||
gt
|
||||
For numbers, this will ensure that the value is greater than the
|
||||
parameter given. For strings, it checks that the string length
|
||||
is greater than that number of characters. For slices, arrays
|
||||
and maps it validates the number of items. (Usage: gt=10)
|
||||
For time.Time ensures the time value is greater than time.Now.UTC()
|
||||
(Usage: gt)
|
||||
|
||||
gte
|
||||
Same as 'min' above. Kept both to make terminology with 'len' easier
|
||||
(Usage: gte=10)
|
||||
For time.Time ensures the time value is greater than or equal to time.Now.UTC()
|
||||
(Usage: gte)
|
||||
|
||||
lt
|
||||
For numbers, this will ensure that the value is
|
||||
less than the parameter given. For strings, it checks
|
||||
that the string length is less than that number of characters.
|
||||
For slices, arrays, and maps it validates the number of items.
|
||||
(Usage: lt=10)
|
||||
For time.Time ensures the time value is less than time.Now.UTC()
|
||||
(Usage: lt)
|
||||
|
||||
lte
|
||||
Same as 'max' above. Kept both to make terminology with 'len' easier
|
||||
(Usage: lte=10)
|
||||
For time.Time ensures the time value is less than or equal to time.Now.UTC()
|
||||
(Usage: lte)
|
||||
|
||||
eqfield
|
||||
This will validate the field value against another fields value either within
|
||||
a struct or passed in field.
|
||||
usage examples are for validation of a password and confirm password:
|
||||
Validation on Password field using validate.Struct Usage(eqfield=ConfirmPassword)
|
||||
Validating by field validate.FieldWithValue(password, confirmpassword, "eqfield")
|
||||
|
||||
nefield
|
||||
This will validate the field value against another fields value either within
|
||||
a struct or passed in field.
|
||||
usage examples are for ensuring two colors are not the same:
|
||||
Validation on Color field using validate.Struct Usage(nefield=Color2)
|
||||
Validating by field validate.FieldWithValue(color1, color2, "nefield")
|
||||
|
||||
gtfield
|
||||
Only valid for Numbers and time.Time types, this will validate the field value
|
||||
against another fields value either within a struct or passed in field.
|
||||
usage examples are for validation of a Start and End date:
|
||||
Validation on End field using validate.Struct Usage(gtfield=Start)
|
||||
Validating by field validate.FieldWithValue(start, end, "gtfield")
|
||||
|
||||
gtefield
|
||||
Only valid for Numbers and time.Time types, this will validate the field value
|
||||
against another fields value either within a struct or passed in field.
|
||||
usage examples are for validation of a Start and End date:
|
||||
Validation on End field using validate.Struct Usage(gtefield=Start)
|
||||
Validating by field validate.FieldWithValue(start, end, "gtefield")
|
||||
|
||||
ltfield
|
||||
Only valid for Numbers and time.Time types, this will validate the field value
|
||||
against another fields value either within a struct or passed in field.
|
||||
usage examples are for validation of a Start and End date:
|
||||
Validation on End field using validate.Struct Usage(ltfield=Start)
|
||||
Validating by field validate.FieldWithValue(start, end, "ltfield")
|
||||
|
||||
ltefield
|
||||
Only valid for Numbers and time.Time types, this will validate the field value
|
||||
against another fields value either within a struct or passed in field.
|
||||
usage examples are for validation of a Start and End date:
|
||||
Validation on End field using validate.Struct Usage(ltefield=Start)
|
||||
Validating by field validate.FieldWithValue(start, end, "ltefield")
|
||||
|
||||
alpha
|
||||
This validates that a string value contains alpha characters only
|
||||
(Usage: alpha)
|
||||
|
||||
alphanum
|
||||
This validates that a string value contains alphanumeric characters only
|
||||
(Usage: alphanum)
|
||||
|
||||
numeric
|
||||
This validates that a string value contains a basic numeric value.
|
||||
basic excludes exponents etc...
|
||||
(Usage: numeric)
|
||||
|
||||
hexadecimal
|
||||
This validates that a string value contains a valid hexadecimal.
|
||||
(Usage: hexadecimal)
|
||||
|
||||
hexcolor
|
||||
This validates that a string value contains a valid hex color including
|
||||
hashtag (#)
|
||||
(Usage: hexcolor)
|
||||
|
||||
rgb
|
||||
This validates that a string value contains a valid rgb color
|
||||
(Usage: rgb)
|
||||
|
||||
rgba
|
||||
This validates that a string value contains a valid rgba color
|
||||
(Usage: rgba)
|
||||
|
||||
hsl
|
||||
This validates that a string value contains a valid hsl color
|
||||
(Usage: hsl)
|
||||
|
||||
hsla
|
||||
This validates that a string value contains a valid hsla color
|
||||
(Usage: hsla)
|
||||
|
||||
email
|
||||
This validates that a string value contains a valid email
|
||||
This may not conform to all possibilities of any rfc standard, but neither
|
||||
does any email provider accept all posibilities...
|
||||
(Usage: email)
|
||||
|
||||
url
|
||||
This validates that a string value contains a valid url
|
||||
This will accept any url the golang request uri accepts but must contain
|
||||
a schema for example http:// or rtmp://
|
||||
(Usage: url)
|
||||
|
||||
uri
|
||||
This validates that a string value contains a valid uri
|
||||
This will accept any uri the golang request uri accepts (Usage: uri)
|
||||
|
||||
base64
|
||||
This validates that a string value contains a valid base64 value.
|
||||
Although an empty string is valid base64 this will report an empty string
|
||||
as an error, if you wish to accept an empty string as valid you can use
|
||||
this with the omitempty tag. (Usage: base64)
|
||||
|
||||
contains
|
||||
This validates that a string value contains the substring value.
|
||||
(Usage: contains=@)
|
||||
|
||||
containsany
|
||||
This validates that a string value contains any Unicode code points
|
||||
in the substring value. (Usage: containsany=!@#?)
|
||||
|
||||
containsrune
|
||||
This validates that a string value contains the supplied rune value.
|
||||
(Usage: containsrune=@)
|
||||
|
||||
excludes
|
||||
This validates that a string value does not contain the substring value.
|
||||
(Usage: excludes=@)
|
||||
|
||||
excludesall
|
||||
This validates that a string value does not contain any Unicode code
|
||||
points in the substring value. (Usage: excludesall=!@#?)
|
||||
|
||||
excludesrune
|
||||
This validates that a string value does not contain the supplied rune value.
|
||||
(Usage: excludesrune=@)
|
||||
|
||||
isbn
|
||||
This validates that a string value contains a valid isbn10 or isbn13 value.
|
||||
(Usage: isbn)
|
||||
|
||||
isbn10
|
||||
This validates that a string value contains a valid isbn10 value.
|
||||
(Usage: isbn10)
|
||||
|
||||
isbn13
|
||||
This validates that a string value contains a valid isbn13 value.
|
||||
(Usage: isbn13)
|
||||
|
||||
uuid
|
||||
This validates that a string value contains a valid UUID.
|
||||
(Usage: uuid)
|
||||
|
||||
uuid3
|
||||
This validates that a string value contains a valid version 3 UUID.
|
||||
(Usage: uuid3)
|
||||
|
||||
uuid4
|
||||
This validates that a string value contains a valid version 4 UUID.
|
||||
(Usage: uuid4)
|
||||
|
||||
uuid5
|
||||
This validates that a string value contains a valid version 5 UUID.
|
||||
(Usage: uuid5)
|
||||
|
||||
ascii
|
||||
This validates that a string value contains only ASCII characters.
|
||||
NOTE: if the string is blank, this validates as true.
|
||||
(Usage: ascii)
|
||||
|
||||
asciiprint
|
||||
This validates that a string value contains only printable ASCII characters.
|
||||
NOTE: if the string is blank, this validates as true.
|
||||
(Usage: asciiprint)
|
||||
|
||||
multibyte
|
||||
This validates that a string value contains one or more multibyte characters.
|
||||
NOTE: if the string is blank, this validates as true.
|
||||
(Usage: multibyte)
|
||||
|
||||
datauri
|
||||
This validates that a string value contains a valid DataURI.
|
||||
NOTE: this will also validate that the data portion is valid base64
|
||||
(Usage: datauri)
|
||||
|
||||
latitude
|
||||
This validates that a string value contains a valid latitude.
|
||||
(Usage: latitude)
|
||||
|
||||
longitude
|
||||
This validates that a string value contains a valid longitude.
|
||||
(Usage: longitude)
|
||||
|
||||
ssn
|
||||
This validates that a string value contains a valid U.S. Social Security Number.
|
||||
(Usage: ssn)
|
||||
|
||||
Validator notes:
|
||||
|
||||
regex
|
||||
a regex validator won't be added because commas and = signs can be part of
|
||||
a regex which conflict with the validation definitions, although workarounds
|
||||
can be made, they take away from using pure regex's. Furthermore it's quick
|
||||
and dirty but the regex's become harder to maintain and are not reusable, so
|
||||
it's as much a programming philosiphy as anything.
|
||||
|
||||
In place of this new validator functions should be created; a regex can be
|
||||
used within the validator function and even be precompiled for better efficiency
|
||||
within regexes.go.
|
||||
|
||||
And the best reason, you can submit a pull request and we can keep on adding to the
|
||||
validation library of this package!
|
||||
|
||||
Panics
|
||||
|
||||
This package panics when bad input is provided, this is by design, bad code like that should not make it to production.
|
||||
|
||||
type Test struct {
|
||||
TestField string `validate:"nonexistantfunction=1"`
|
||||
}
|
||||
|
||||
t := &Test{
|
||||
TestField: "Test"
|
||||
}
|
||||
|
||||
validate.Struct(t) // this will panic
|
||||
*/
|
||||
package validator
|
|
@ -1,64 +0,0 @@
|
|||
package validator
|
||||
|
||||
import "regexp"
|
||||
|
||||
const (
|
||||
alphaRegexString = "^[a-zA-Z]+$"
|
||||
alphaNumericRegexString = "^[a-zA-Z0-9]+$"
|
||||
numericRegexString = "^[-+]?[0-9]+(?:\\.[0-9]+)?$"
|
||||
numberRegexString = "^[0-9]+$"
|
||||
hexadecimalRegexString = "^[0-9a-fA-F]+$"
|
||||
hexcolorRegexString = "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
|
||||
rgbRegexString = "^rgb\\(\\s*(?:(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])|(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%)\\s*\\)$"
|
||||
rgbaRegexString = "^rgba\\(\\s*(?:(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])|(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%)\\s*,\\s*(?:(?:0.[1-9]*)|[01])\\s*\\)$"
|
||||
hslRegexString = "^hsl\\(\\s*(?:0|[1-9]\\d?|[12]\\d\\d|3[0-5]\\d|360)\\s*,\\s*(?:(?:0|[1-9]\\d?|100)%)\\s*,\\s*(?:(?:0|[1-9]\\d?|100)%)\\s*\\)$"
|
||||
hslaRegexString = "^hsla\\(\\s*(?:0|[1-9]\\d?|[12]\\d\\d|3[0-5]\\d|360)\\s*,\\s*(?:(?:0|[1-9]\\d?|100)%)\\s*,\\s*(?:(?:0|[1-9]\\d?|100)%)\\s*,\\s*(?:(?:0.[1-9]*)|[01])\\s*\\)$"
|
||||
emailRegexString = "^(?:(?:(?:(?:[a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(?:\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|(?:(?:\\x22)(?:(?:(?:(?:\\x20|\\x09)*(?:\\x0d\\x0a))?(?:\\x20|\\x09)+)?(?:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(?:\\(?:[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(?:(?:(?:\\x20|\\x09)*(?:\\x0d\\x0a))?(\\x20|\\x09)+)?(?:\\x22)))@(?:(?:(?:[a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(?:(?:[a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])(?:[a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*(?:[a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(?:(?:[a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(?:(?:[a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])(?:[a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*(?:[a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.?$"
|
||||
base64RegexString = "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$"
|
||||
iSBN10RegexString = "^(?:[0-9]{9}X|[0-9]{10})$"
|
||||
iSBN13RegexString = "^(?:(?:97(?:8|9))[0-9]{10})$"
|
||||
uUID3RegexString = "^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
||||
uUID4RegexString = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
||||
uUID5RegexString = "^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
||||
uUIDRegexString = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
||||
aSCIIRegexString = "^[\x00-\x7F]*$"
|
||||
printableASCIIRegexString = "^[\x20-\x7E]*$"
|
||||
multibyteRegexString = "[^\x00-\x7F]"
|
||||
dataURIRegexString = "^data:.+\\/(.+);base64$"
|
||||
latitudeRegexString = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$"
|
||||
longitudeRegexString = "^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"
|
||||
sSNRegexString = `^\d{3}[- ]?\d{2}[- ]?\d{4}$`
|
||||
)
|
||||
|
||||
var (
|
||||
alphaRegex = regexp.MustCompile(alphaRegexString)
|
||||
alphaNumericRegex = regexp.MustCompile(alphaNumericRegexString)
|
||||
numericRegex = regexp.MustCompile(numericRegexString)
|
||||
numberRegex = regexp.MustCompile(numberRegexString)
|
||||
hexadecimalRegex = regexp.MustCompile(hexadecimalRegexString)
|
||||
hexcolorRegex = regexp.MustCompile(hexcolorRegexString)
|
||||
rgbRegex = regexp.MustCompile(rgbRegexString)
|
||||
rgbaRegex = regexp.MustCompile(rgbaRegexString)
|
||||
hslRegex = regexp.MustCompile(hslRegexString)
|
||||
hslaRegex = regexp.MustCompile(hslaRegexString)
|
||||
emailRegex = regexp.MustCompile(emailRegexString)
|
||||
base64Regex = regexp.MustCompile(base64RegexString)
|
||||
iSBN10Regex = regexp.MustCompile(iSBN10RegexString)
|
||||
iSBN13Regex = regexp.MustCompile(iSBN13RegexString)
|
||||
uUID3Regex = regexp.MustCompile(uUID3RegexString)
|
||||
uUID4Regex = regexp.MustCompile(uUID4RegexString)
|
||||
uUID5Regex = regexp.MustCompile(uUID5RegexString)
|
||||
uUIDRegex = regexp.MustCompile(uUIDRegexString)
|
||||
aSCIIRegex = regexp.MustCompile(aSCIIRegexString)
|
||||
printableASCIIRegex = regexp.MustCompile(printableASCIIRegexString)
|
||||
multibyteRegex = regexp.MustCompile(multibyteRegexString)
|
||||
dataURIRegex = regexp.MustCompile(dataURIRegexString)
|
||||
latitudeRegex = regexp.MustCompile(latitudeRegexString)
|
||||
longitudeRegex = regexp.MustCompile(longitudeRegexString)
|
||||
sSNRegex = regexp.MustCompile(sSNRegexString)
|
||||
)
|
||||
|
||||
func matchesRegex(regex *regexp.Regexp, field interface{}) bool {
|
||||
fieldAsString := field.(string) //this will panic inherently
|
||||
return regex.MatchString(fieldAsString)
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,29 @@
|
|||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
*.test
|
||||
*.out
|
||||
*.txt
|
||||
cover.html
|
||||
README.html
|
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 11 KiB После Ширина: | Высота: | Размер: 13 KiB |
|
@ -0,0 +1,8 @@
|
|||
_test
|
||||
_testmain.go
|
||||
_obj
|
||||
*~
|
||||
*.6
|
||||
6.out
|
||||
gorptest.bin
|
||||
tmp
|
|
@ -0,0 +1,21 @@
|
|||
language: go
|
||||
go:
|
||||
- 1.1
|
||||
- tip
|
||||
|
||||
services:
|
||||
- mysql
|
||||
- postgres
|
||||
- sqlite3
|
||||
|
||||
before_script:
|
||||
- mysql -e "CREATE DATABASE gorptest;"
|
||||
- mysql -u root -e "GRANT ALL ON gorptest.* TO gorptest@localhost IDENTIFIED BY 'gorptest'"
|
||||
- psql -c "CREATE DATABASE gorptest;" -U postgres
|
||||
- psql -c "CREATE USER "gorptest" WITH SUPERUSER PASSWORD 'gorptest';" -U postgres
|
||||
- go get github.com/lib/pq
|
||||
- go get github.com/mattn/go-sqlite3
|
||||
- go get github.com/ziutek/mymysql/godrv
|
||||
- go get github.com/go-sql-driver/mysql
|
||||
|
||||
script: ./test_all.sh
|
|
@ -0,0 +1,9 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.4
|
||||
- 1.5
|
||||
- 1.6
|
||||
- tip
|
||||
|
||||
go_import_path: gopkg.in/yaml.v2
|
|
@ -0,0 +1,100 @@
|
|||
# github.com/BurntSushi/toml v0.1.1-0.20150501104042-056c9bc7be71
|
||||
## explicit
|
||||
github.com/BurntSushi/toml
|
||||
# github.com/Sirupsen/logrus v0.6.7-0.20150309155839-2cea0f0d141f
|
||||
## explicit
|
||||
github.com/Sirupsen/logrus
|
||||
# github.com/dgrijalva/jwt-go v2.2.1-0.20150401180636-c48cfd5d9711+incompatible
|
||||
## explicit
|
||||
github.com/dgrijalva/jwt-go
|
||||
# github.com/elazarl/go-bindata-assetfs v0.0.0-20150414184409-bea323321994
|
||||
## explicit
|
||||
github.com/elazarl/go-bindata-assetfs
|
||||
# github.com/franela/goblin v0.0.0-20150112000940-2042c4d610d2
|
||||
## explicit
|
||||
github.com/franela/goblin
|
||||
# github.com/gin-gonic/contrib v0.0.0-20150815172543-14f66d54cdb9
|
||||
## explicit
|
||||
github.com/gin-gonic/contrib/ginrus
|
||||
# github.com/gin-gonic/gin v0.0.0-20160414233928-5caaac4c5c71
|
||||
## explicit
|
||||
github.com/gin-gonic/gin
|
||||
github.com/gin-gonic/gin/binding
|
||||
github.com/gin-gonic/gin/render
|
||||
# github.com/go-sql-driver/mysql v1.2.1-0.20151112163355-d512f204a577
|
||||
## explicit
|
||||
github.com/go-sql-driver/mysql
|
||||
# github.com/golang/protobuf v0.0.0-20160418235422-2ebff28ac76f
|
||||
## explicit
|
||||
github.com/golang/protobuf/proto
|
||||
# github.com/google/go-github v14.0.1-0.20171221173707-0c3b302de2a6+incompatible
|
||||
## explicit
|
||||
github.com/google/go-github/github
|
||||
# github.com/google/go-querystring v0.0.0-20151028211038-2a60fc2ba6c1
|
||||
## explicit
|
||||
github.com/google/go-querystring/query
|
||||
# github.com/ianschenck/envflag v0.0.0-20140720210342-9111d830d133
|
||||
## explicit
|
||||
github.com/ianschenck/envflag
|
||||
# github.com/joho/godotenv v0.0.0-20150907010228-4ed13390c0ac
|
||||
## explicit
|
||||
github.com/joho/godotenv
|
||||
github.com/joho/godotenv/autoload
|
||||
# github.com/koding/cache v0.0.0-20140912085602-487fc0ca06f9
|
||||
## explicit
|
||||
github.com/koding/cache
|
||||
# github.com/lib/pq v0.0.0-20161103024354-d8eeeb8bae88
|
||||
## explicit
|
||||
github.com/lib/pq
|
||||
github.com/lib/pq/oid
|
||||
# github.com/manucorporat/sse v0.0.0-20150715184805-fe6ea2c8e398
|
||||
## explicit
|
||||
github.com/manucorporat/sse
|
||||
# github.com/mattn/go-sqlite3 v0.0.0-20150427235825-542ae647f860
|
||||
## explicit
|
||||
github.com/mattn/go-sqlite3
|
||||
# github.com/rubenv/sql-migrate v0.0.0-20150713140751-53184e1edfb4
|
||||
## explicit
|
||||
github.com/rubenv/sql-migrate
|
||||
github.com/rubenv/sql-migrate/sqlparse
|
||||
# github.com/russross/meddler v0.0.0-20150103201139-cd98050d9328
|
||||
## explicit
|
||||
github.com/russross/meddler
|
||||
# github.com/stretchr/objx v0.0.0-20140526180921-cbeaeb16a013
|
||||
## explicit
|
||||
github.com/stretchr/objx
|
||||
# github.com/stretchr/testify v0.0.0-20150504220033-73a8112e0560
|
||||
## explicit
|
||||
github.com/stretchr/testify/assert
|
||||
github.com/stretchr/testify/mock
|
||||
# github.com/ziutek/mymysql v1.5.4
|
||||
## explicit
|
||||
# golang.org/x/net v0.0.0-20151128090656-62ac18b46160
|
||||
## explicit
|
||||
golang.org/x/net/context
|
||||
# golang.org/x/oauth2 v0.0.0-20151117210313-442624c9ec92
|
||||
## explicit
|
||||
golang.org/x/oauth2
|
||||
golang.org/x/oauth2/internal
|
||||
# google.golang.org/appengine v0.0.0-20160914034556-78199dcb0669
|
||||
## explicit
|
||||
google.golang.org/appengine/internal
|
||||
google.golang.org/appengine/internal/base
|
||||
google.golang.org/appengine/internal/datastore
|
||||
google.golang.org/appengine/internal/log
|
||||
google.golang.org/appengine/internal/remote_api
|
||||
google.golang.org/appengine/internal/urlfetch
|
||||
google.golang.org/appengine/urlfetch
|
||||
# gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
|
||||
## explicit
|
||||
# gopkg.in/go-playground/assert.v1 v1.2.1
|
||||
## explicit
|
||||
# gopkg.in/go-playground/validator.v8 v8.17.1
|
||||
## explicit
|
||||
gopkg.in/go-playground/validator.v8
|
||||
# gopkg.in/gorp.v1 v1.7.1
|
||||
## explicit
|
||||
gopkg.in/gorp.v1
|
||||
# gopkg.in/yaml.v2 v2.0.0-20160301204022-a83829b6f129
|
||||
## explicit
|
||||
gopkg.in/yaml.v2
|
|
@ -1,232 +0,0 @@
|
|||
{
|
||||
"comment": "",
|
||||
"ignore": "test",
|
||||
"package": [
|
||||
{
|
||||
"path": "github.com/BurntSushi/toml",
|
||||
"revision": "056c9bc7be7190eaa7715723883caffa5f8fa3e4",
|
||||
"revisionTime": "2015-05-01T06:40:42-04:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/Sirupsen/logrus",
|
||||
"revision": "2cea0f0d141f56fae06df5b813ec4119d1c8ccbd",
|
||||
"revisionTime": "2015-03-09T11:58:39-04:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/dgrijalva/jwt-go",
|
||||
"revision": "c48cfd5d9711c75acb6036d2698ef3aef7bb655a",
|
||||
"revisionTime": "2015-04-01T11:06:36-07:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/elazarl/go-bindata-assetfs",
|
||||
"revision": "bea323321994103859d60197d229f1a94699dde3",
|
||||
"revisionTime": "2015-04-14T21:44:09+03:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/franela/goblin",
|
||||
"revision": "2042c4d610d2da4e4d2afd754da0b4eef31753bb",
|
||||
"revisionTime": "2015-01-11T21:09:40-03:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/gin-gonic/contrib/ginrus",
|
||||
"revision": "14f66d54cdb96059bafca98665bcc6d9df4951f2",
|
||||
"revisionTime": "2015-08-15T19:25:43+02:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/gin-gonic/gin",
|
||||
"revision": "5caaac4c5c712a9e7a7de29e6c24ef46c753017f",
|
||||
"revisionTime": "2016-04-15T01:39:28+02:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/gin-gonic/gin/binding",
|
||||
"revision": "5caaac4c5c712a9e7a7de29e6c24ef46c753017f",
|
||||
"revisionTime": "2016-04-15T01:39:28+02:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/gin-gonic/gin/render",
|
||||
"revision": "5caaac4c5c712a9e7a7de29e6c24ef46c753017f",
|
||||
"revisionTime": "2016-04-15T01:39:28+02:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/go-sql-driver/mysql",
|
||||
"revision": "d512f204a577a4ab037a1816604c48c9c13210be",
|
||||
"revisionTime": "2015-11-12T17:33:55+01:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/golang/protobuf/proto",
|
||||
"revision": "2ebff28ac76fb19e2d25e5ddd4885708dfdd5611",
|
||||
"revisionTime": "2016-04-18T12:44:00+10:00"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "7DjNfAN2tzT4sW2qNBSQnGuAipk=",
|
||||
"path": "github.com/google/go-github/github",
|
||||
"revision": "0c3b302de2a6de84a2511db47ea1bb2ff8146830",
|
||||
"revisionTime": "2017-12-21T17:37:07Z"
|
||||
},
|
||||
{
|
||||
"path": "github.com/google/go-querystring/query",
|
||||
"revision": "2a60fc2ba6c19de80291203597d752e9ba58e4c0",
|
||||
"revisionTime": "2015-10-28T14:53:53-04:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/ianschenck/envflag",
|
||||
"revision": "9111d830d133f952887a936367fb0211c3134f0d",
|
||||
"revisionTime": "2014-07-20T15:03:42-06:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/joho/godotenv",
|
||||
"revision": "4ed13390c0acd2ff4e371e64d8b97c8954138243",
|
||||
"revisionTime": "2015-09-07T11:02:28+10:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/joho/godotenv/autoload",
|
||||
"revision": "4ed13390c0acd2ff4e371e64d8b97c8954138243",
|
||||
"revisionTime": "2015-09-07T11:02:28+10:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/koding/cache",
|
||||
"revision": "487fc0ca06f9aa1a02d796f5510784b47d5afae2",
|
||||
"revisionTime": "2014-09-12T11:56:02+03:00"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "avqi4lkviHdrNJ92cXCwrw9x870=",
|
||||
"path": "github.com/lib/pq",
|
||||
"revision": "d8eeeb8bae8896dd8e1b7e514ab0d396c4f12a1b",
|
||||
"revisionTime": "2016-11-03T02:43:54Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "xppHi82MLqVx1eyQmbhTesAEjx8=",
|
||||
"path": "github.com/lib/pq/oid",
|
||||
"revision": "d8eeeb8bae8896dd8e1b7e514ab0d396c4f12a1b",
|
||||
"revisionTime": "2016-11-03T02:43:54Z"
|
||||
},
|
||||
{
|
||||
"path": "github.com/manucorporat/sse",
|
||||
"revision": "fe6ea2c8e398672518ef204bf0fbd9af858d0e15",
|
||||
"revisionTime": "2015-07-15T20:48:05+02:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/mattn/go-colorable",
|
||||
"revision": "3dac7b4f76f6e17fb39b768b89e3783d16e237fe",
|
||||
"revisionTime": "2015-11-27T10:45:55+09:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/mattn/go-isatty",
|
||||
"revision": "7fcbc72f853b92b5720db4a6b8482be612daef24",
|
||||
"revisionTime": "2015-08-14T09:26:29+09:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/mattn/go-sqlite3",
|
||||
"revision": "542ae647f8601bafd96233961b150cae198e0295",
|
||||
"revisionTime": "2015-04-28T08:57:25+09:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/rubenv/sql-migrate",
|
||||
"revision": "53184e1edfb4f9655b0fa8dd2c23e7763f452bda",
|
||||
"revisionTime": "2015-07-13T16:07:51+02:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/rubenv/sql-migrate/sqlparse",
|
||||
"revision": "53184e1edfb4f9655b0fa8dd2c23e7763f452bda",
|
||||
"revisionTime": "2015-07-13T16:07:51+02:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/russross/meddler",
|
||||
"revision": "cd98050d9328eb98ed57de34c74660dea3ca5df4",
|
||||
"revisionTime": "2015-01-03T13:11:39-07:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/stretchr/objx",
|
||||
"revision": "cbeaeb16a013161a98496fad62933b1d21786672",
|
||||
"revisionTime": "2014-05-26T12:09:21-06:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/stretchr/testify/assert",
|
||||
"revision": "73a8112e05603706e47153d5cbb86aac8d85adb0",
|
||||
"revisionTime": "2015-05-04T23:00:33+01:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/stretchr/testify/mock",
|
||||
"revision": "73a8112e05603706e47153d5cbb86aac8d85adb0",
|
||||
"revisionTime": "2015-05-04T23:00:33+01:00"
|
||||
},
|
||||
{
|
||||
"path": "golang.org/x/net/context",
|
||||
"revision": "62ac18b461605b4be188bbc7300e9aa2bc836cd4",
|
||||
"revisionTime": "2015-11-04T16:49:45+09:00"
|
||||
},
|
||||
{
|
||||
"path": "golang.org/x/oauth2",
|
||||
"revision": "442624c9ec9243441e83b374a9e22ac549b5c51d",
|
||||
"revisionTime": "2015-11-16T13:49:40-08:00"
|
||||
},
|
||||
{
|
||||
"path": "golang.org/x/oauth2/internal",
|
||||
"revision": "442624c9ec9243441e83b374a9e22ac549b5c51d",
|
||||
"revisionTime": "2015-11-16T13:49:40-08:00"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "4lEP/dEWOMb4r2Aehu0D9iBDgIU=",
|
||||
"path": "google.golang.org/appengine/internal",
|
||||
"revision": "78199dcb0669fc381c22e919e1e97eba879e8f60",
|
||||
"revisionTime": "2016-09-14T03:40:34Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "TsNO8P0xUlLNyh3Ic/tzSp/fDWM=",
|
||||
"path": "google.golang.org/appengine/internal/base",
|
||||
"revision": "78199dcb0669fc381c22e919e1e97eba879e8f60",
|
||||
"revisionTime": "2016-09-14T03:40:34Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "5QsV5oLGSfKZqTCVXP6NRz5T4Tw=",
|
||||
"path": "google.golang.org/appengine/internal/datastore",
|
||||
"revision": "78199dcb0669fc381c22e919e1e97eba879e8f60",
|
||||
"revisionTime": "2016-09-14T03:40:34Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "Gep2T9zmVYV8qZfK2gu3zrmG6QE=",
|
||||
"path": "google.golang.org/appengine/internal/log",
|
||||
"revision": "78199dcb0669fc381c22e919e1e97eba879e8f60",
|
||||
"revisionTime": "2016-09-14T03:40:34Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "a1XY7rz3BieOVqVI2Et6rKiwQCk=",
|
||||
"path": "google.golang.org/appengine/internal/remote_api",
|
||||
"revision": "78199dcb0669fc381c22e919e1e97eba879e8f60",
|
||||
"revisionTime": "2016-09-14T03:40:34Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "QtAbHtHmDzcf6vOV9eqlCpKgjiw=",
|
||||
"path": "google.golang.org/appengine/internal/urlfetch",
|
||||
"revision": "78199dcb0669fc381c22e919e1e97eba879e8f60",
|
||||
"revisionTime": "2016-09-14T03:40:34Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "akOV9pYnCbcPA8wJUutSQVibdyg=",
|
||||
"path": "google.golang.org/appengine/urlfetch",
|
||||
"revision": "78199dcb0669fc381c22e919e1e97eba879e8f60",
|
||||
"revisionTime": "2016-09-14T03:40:34Z"
|
||||
},
|
||||
{
|
||||
"path": "gopkg.in/bluesuncorp/validator.v5",
|
||||
"revision": "d5acf1dac43705f8bfbb71d878e290e2bed3950b",
|
||||
"revisionTime": "2015-09-24T07:44:28-04:00"
|
||||
},
|
||||
{
|
||||
"path": "gopkg.in/go-playground/validator.v8",
|
||||
"revision": "014792cf3e266caff1e916876be12282b33059e0",
|
||||
"revisionTime": "2016-02-23T15:26:51-05:00"
|
||||
},
|
||||
{
|
||||
"path": "gopkg.in/gorp.v1",
|
||||
"revision": "c87af80f3cc5036b55b83d77171e156791085e2e",
|
||||
"revisionTime": "2015-02-04T09:55:30+01:00"
|
||||
},
|
||||
{
|
||||
"path": "gopkg.in/yaml.v2",
|
||||
"revision": "a83829b6f1293c91addabc89d0571c246397bbf4",
|
||||
"revisionTime": "2016-03-01T17:40:22-03:00"
|
||||
}
|
||||
],
|
||||
"rootPath": "github.com/go-gitea/lgtm"
|
||||
}
|
Загрузка…
Ссылка в новой задаче