Skip to content

Commit

Permalink
Add github.com/stretchr/testify@v1.5.1 as an internal submodule (#56)
Browse files Browse the repository at this point in the history
* Add github.com/stretchr/testify@v1.5.1 as an internal submodule

Adds the testify testing framework as an internal Go submodule. The Go
submodule import paths are all rewritten to refer to its self, and had
its gopkg.in/yaml.v2 dependency updated to a that is not vulnerable to
CVE-2019-11254.

The submodule was created instead of updating the testify dependency,
because testify@v1.6.0 which updated to yaml.v3 is not compatible with
Go versions < v1.12.

* update CI tasks to build for all go verisons and test for latest
  • Loading branch information
jasdel authored Sep 18, 2020
1 parent 2437e84 commit ff168ca
Show file tree
Hide file tree
Showing 52 changed files with 15,509 additions and 9 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ go:
- 1.12.x
- 1.13.x
- 1.14.x
- 1.15.x
- tip

allow_failures:
- go: tip

install: go get -v -t ./...
script: make test
script: make build

matrix:
include:
- language: go
go: 1.15.x
script: make test
24 changes: 17 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

CMD = jpgo

SRC_PKGS=./ ./cmd/... ./fuzz/...

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " test to run all the tests"
Expand All @@ -9,21 +11,25 @@ help:


generate:
go generate ./...
go generate ${SRC_PKGS}

get-deps:
go get -v -t ./ ./cmd/... ./compliance/... ./fuzz/...

build:
rm -f $(CMD)
go build ./...
go build ${SRC_PKGS}
rm -f cmd/$(CMD)/$(CMD) && cd cmd/$(CMD)/ && go build ./...
mv cmd/$(CMD)/$(CMD) .

test:
go test -v ./...
test: test-internal-testify
echo "making tests ${SRC_PKGS}"
go test -v ${SRC_PKGS}

check:
go vet ./...
@echo "golint ./..."
@lint=`golint ./...`; \
go vet ${SRC_PKGS}
@echo "golint ${SRC_PKGS}"
@lint=`golint ${SRC_PKGS}`; \
lint=`echo "$$lint" | grep -v "astnodetype_string.go" | grep -v "toktype_string.go"`; \
echo "$$lint"; \
if [ "$$lint" != "" ]; then exit 1; fi
Expand All @@ -42,3 +48,7 @@ bench:

pprof-cpu:
go tool pprof ./go-jmespath.test ./cpu.out

test-internal-testify:
cd internal/testify && go test ./...

24 changes: 24 additions & 0 deletions internal/testify/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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

.DS_Store
14 changes: 14 additions & 0 deletions internal/testify/.travis.gofmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

if [ -n "$(gofmt -l .)" ]; then
echo "Go code is not formatted:"
gofmt -d .
exit 1
fi

go generate ./...
if [ -n "$(git status -s -uno)" ]; then
echo "Go generate output does not match commit."
echo "Did you forget to run go generate ./... ?"
exit 1
fi
16 changes: 16 additions & 0 deletions internal/testify/.travis.gogenerate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# If GOMOD is defined we are running with Go Modules enabled, either
# automatically or via the GO111MODULE=on environment variable. Codegen only
# works with modules, so skip generation if modules is not in use.
if [[ -z "$(go env GOMOD)" ]]; then
echo "Skipping go generate because modules not enabled and required"
exit 0
fi

go generate ./...
if [ -n "$(git diff)" ]; then
echo "Go generate had not been run"
git diff
exit 1
fi
5 changes: 5 additions & 0 deletions internal/testify/.travis.govet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

go vet ./...
27 changes: 27 additions & 0 deletions internal/testify/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
language: go

sudo: false

matrix:
include:
- go: "1.8.x"
- go: "1.9.x"
- go: "1.10.x"
- go: "1.11.x"
env: GO111MODULE=off
- go: "1.11.x"
env: GO111MODULE=on
- go: "1.12.x"
env: GO111MODULE=off
- go: "1.12.x"
env: GO111MODULE=on
- go: "1.13.x"
env: GO111MODULE=off
- go: "1.13.x"
env: GO111MODULE=on
- go: master
script:
- ./.travis.gogenerate.sh
- ./.travis.gofmt.sh
- ./.travis.govet.sh
- go test -v -race ./...
50 changes: 50 additions & 0 deletions internal/testify/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Contributing to Testify

So you'd like to contribute to Testify? First of all, thank you! Testify is widely used, so each
contribution has a significant impact within the Golang community! Below you'll find everything you
need to know to get up to speed on the project.

## Philosophy

The Testify maintainers generally attempt to follow widely accepted practices within the Golang
community. That being said, the first priority is always to make sure that the package is useful to
the community. A few general guidelines are listed here:

*Keep it simple (whenever practical)* - Try not to expand the API unless the new surface area
provides meaningful benefits. For example, don't add functions because they might be useful to
someone, someday. Add what is useful to specific users, today.

*Ease of use is paramount* - This means good documentation and package organization. It also means
that we should try hard to use meaningful, descriptive function names, avoid breaking the API
unnecessarily, and try not to surprise the user.

*Quality isn't an afterthought* - Testify is a testing library, so it seems reasonable that we
should have a decent test suite. This is doubly important because a bug in Testify doesn't just mean
a bug in our users' code, it means a bug in our users' tests, which means a potentially unnoticed
and hard-to-find bug in our users' code.

## Pull Requests

We welcome pull requests! Please include the following in the description:

* Motivation, why your change is important or helpful
* Example usage (if applicable)
* Whether you intend to add / change behavior or fix a bug

Please be aware that the maintainers may ask for changes. This isn't a commentary on the quality of
your idea or your code. Testify is the result of many contributions from many individuals, so we
need to enforce certain practices and patterns to keep the package easy for others to understand.
Essentially, we recognize that there are often many good ways to do a given thing, but we have to
pick one and stick with it.

See `MAINTAINERS.md` for a list of users who can approve / merge your changes.

## Issues

If you find a bug or think of a useful feature you'd like to see added to Testify, the best thing
you can do is make the necessary changes and open a pull request (see above). If that isn't an
option, or if you'd like to discuss your change before you write the code, open an issue!

Please provide enough context in the issue description that other members of the community can
easily understand what it is that you'd like to see.

21 changes: 21 additions & 0 deletions internal/testify/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2012-2018 Mat Ryer and Tyler Bunnell

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.
8 changes: 8 additions & 0 deletions internal/testify/MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Testify Maintainers

The individuals listed below are active in the project and have the ability to approve and merge
pull requests.

* @glesica
* @boyan-soubachov

Loading

0 comments on commit ff168ca

Please sign in to comment.