Library that make mocking of Go functions/methods easy

mockit

Go Report Card CI Status GoDoc

Mockit is a library to use during testing for Go application, and aim to make mocking of functions/methods easy.

Notes

This is still a working in progress so API might change before reaching a stable state.

Also please note that the mocking might not work in some cases if function inlining is enabled, so it might be necessary to disable it during testing:

go test -gcflags=-l

Usage

To mock a function:

m := MockFunc(t, filepath.Base)
m.With("some-argument").Return("result")

This will make sure that when filepath.Base is called with the argument some-argument, it will return result.

To mock an instance method (at the moment only exported methods are supported):

err := errors.New("some-error")
m := MockMethod(t, err, err.Error)
m.With().Return("some-other-value")

To mock a method for all the instances of a type:

err := errors.New("some-error")
m := MockMethodForAll(t, err, err.Error)
m.With().Return("some-other-value")

When a method is mocked and a matching call is not found (i.e. arguments are different) it will return the zero values.

It is possible to make the mock call the real method:

m.With("some-argument").CallRealMethod()

or return zero values:

m.With("some-argument").ReturnDefaults()

Mocks are matched in order, which means that:

m.With("some-argument").CallRealMethod()
m.With("some-argument").ReturnDefaults()

will make filepath.Base("some-argument") call the real method.

Mocks are automatically removed when the test is completed.

Argument matcher

It is also possible to use argument matchers, to implement generic behaviors. At the moment there is only one matcher implemented, and it matches any argument:

m := MockFunc(t, filepath.Base)
m.With(argument.any).Return("result")

This will make filepath.Base return result for any input.

Capture argument

To capture the argument of a call:

m := MockFunc(t, filepath.Base)
c := argument.Captor{}
m.With(c.Capture).Return("result")
filepath.Base("some-argument")

At this point c.Value will be some argument.

Pausing and restoring a mock

It is possible to temporary disable a mock:

m := MockFunc(t, filepath.Base)
m.With("matching-argument").Return("some-out")

// ... Do something with the mock

m.Disable()

At this point the mock is disabled and the real implementation is used.

To enable the mock again, just use:

m.Enable()

Verify a call

To verify a specified call happened:

m := MockFunc(t, filepath.Base)

// ... Mock calls
// ... And use mock

m.Verify("matching-argument")

The Verify method will fail the test if the call didn't happen.

Update the library

To update the library to the latest version simply run:

go get -u github.com/pasdam/mockit

Development

TODOs

This are (not in a particular order) the missing features that are going to be implemented in a not well defined future (patches are welcome):

Contributing

Rules to contribute to the repo:

  1. Define ine identifier per file, which means that each go file contains either a struct (with related methods), an interface, or a function. Constants should be declared in the file <package>.go, i.e. in mockit.go for the mockit package.
  2. Write unit test for each method/function, in order to keep the coverage to 100%.

Internals

This library uses monkey, a package for monkey patching in Go. And of course it inherits the same limitations, in particular:

Monkey sometimes fails to patch a function if inlining is enabled. Try running your tests with inlining disabled, for example: go test -gcflags=-l.

Credits

All of this was possible only because of bouk, as this library is basically a wrapper around monkey, so kudos to him.

Comments
  • Bump github.com/stretchr/testify from 1.6.1 to 1.7.1

    Bump github.com/stretchr/testify from 1.6.1 to 1.7.1

    Bumps github.com/stretchr/testify from 1.6.1 to 1.7.1.

    Release notes

    Sourced from github.com/stretchr/testify's releases.

    Minor improvements and bug fixes

    Minor feature improvements and bug fixes

    Commits
    • 083ff1c Fixed didPanic to now detect panic(nil).
    • 1e36bfe Use cross Go version compatible build tag syntax
    • e798dc2 Add docs on 1.17 build tags
    • 83198c2 assert: guard CanConvert call in backward compatible wrapper
    • 087b655 assert: allow comparing time.Time
    • 7bcf74e fix msgAndArgs forwarding
    • c29de71 add tests for correct msgAndArgs forwarding
    • f87e2b2 Update builds
    • ab6dc32 fix linting errors in /assert package
    • edff5a0 fix funtion name
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/upload-artifact from 3.0.0 to 3.1.0

    Bump actions/upload-artifact from 3.0.0 to 3.1.0

    Bumps actions/upload-artifact from 3.0.0 to 3.1.0.

    Release notes

    Sourced from actions/upload-artifact's releases.

    v3.1.0

    What's Changed

    Commits
    • 3cea537 Merge pull request #327 from actions/robherley/artifact-1.1.0
    • 849aa77 nvm use 12 & npm run release
    • 4d39869 recompile with correct ncc version
    • 2e0d362 bump @​actions/artifact to 1.1.0
    • 09a5d6a Merge pull request #320 from actions/dependabot/npm_and_yarn/ansi-regex-4.1.1
    • 189315d Bump ansi-regex from 4.1.0 to 4.1.1
    • d159c2d Merge pull request #297 from actions/dependabot/npm_and_yarn/ajv-6.12.6
    • c26a7ba Bump ajv from 6.11.0 to 6.12.6
    • 6ed6c72 Merge pull request #303 from actions/dependabot/npm_and_yarn/yargs-parser-13.1.2
    • 2aeee26 Bump yargs-parser from 13.1.1 to 13.1.2
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/setup-go from 3.0.0 to 3.2.0

    Bump actions/setup-go from 3.0.0 to 3.2.0

    Bumps actions/setup-go from 3.0.0 to 3.2.0.

    Release notes

    Sourced from actions/setup-go's releases.

    Support for caching dependency files and compiler's build outputs

    This release introduces support for caching dependency files and compiler's build outputs #228. For that action uses @​toolkit/cache library under the hood that in turn allows getting rid of configuring @​actions/cache action separately and simplifies the whole workflow.

    Such input parameters as cache and cache-dependency-path were added. The cache input is optional, and caching is turned off by default, cache-dependency-path is used to specify the path to a dependency file - go.sum.

    Examples of use-cases:

    • cache input only:
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-go@v3
      with:
        go-version: '18'
        cache: true
    
    • cache along with cache-dependency-path:
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-go@v3
      with:
        go-version: '18'
        cache: true
        cache-dependency-path: subdir/go.sum
    

    Add go-version-file input

    Adding Go version file support

    In scope of this release we add the go-version-file input. The new input (go-version-file) provides functionality to specify the path to the file containing Go version with such behaviour:

    • If the file does not exist the action will throw an error.
    • If you specify both go-version and go-version-file inputs, the action will use value from the go-version input and throw the following warning: Both go-version and go-version-file inputs are specified, only go-version will be used.
    • For now the action supports .go-version and go.mod files.
    steps:
     - uses: actions/checkout@v3
     - uses: actions/setup-go@v3
       with:
         go-version-file: 'path/to/go.mod'
     - run: go version
    

    Besides, the following pull requests included in this release:

    ... (truncated)

    Commits
    • b22fbbc Implementation of caching functionality for setup-go action (#228)
    • fcdc436 Update @​zeit/ncc to @​vercel/ncc (#229)
    • 265edc1 Add go-version-file option (#62)
    • 193b404 Successfully set up (#231)
    • 56a61c9 Create ADR for integrating cache functionality to setup-go action (#217)
    • b46db95 Merge pull request #222 from vsafonkin/v-vsafonkin/add-readme-note
    • 3332358 Add note about go building
    • 46eabca Merge pull request #221 from vsafonkin/v-vsafonkin/fix-gopath-condition
    • 0794822 Rename CONDUCT.md and change email inside (#218)
    • ad70bef Fix condition for old go versions
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/checkout from 3.0.0 to 3.0.2

    Bump actions/checkout from 3.0.0 to 3.0.2

    Bumps actions/checkout from 3.0.0 to 3.0.2.

    Release notes

    Sourced from actions/checkout's releases.

    v3.0.2

    What's Changed

    Full Changelog: https://github.com/actions/checkout/compare/v3...v3.0.2

    v3.0.1

    Changelog

    Sourced from actions/checkout's changelog.

    v3.0.2

    v3.0.1

    v3.0.0

    v2.3.1

    v2.3.0

    v2.2.0

    v2.1.1

    • Changes to support GHES (here and here)

    v2.1.0

    v2.0.0

    v2 (beta)

    • Improved fetch performance
      • The default behavior now fetches only the SHA being checked-out
    • Script authenticated git commands

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/checkout from 3.0.2 to 3.2.0

    Bump actions/checkout from 3.0.2 to 3.2.0

    Bumps actions/checkout from 3.0.2 to 3.2.0.

    Release notes

    Sourced from actions/checkout's releases.

    v3.2.0

    What's Changed

    New Contributors

    Full Changelog: https://github.com/actions/checkout/compare/v3...v3.2.0

    v3.1.0

    What's Changed

    New Contributors

    Full Changelog: https://github.com/actions/checkout/compare/v3.0.2...v3.1.0

    Changelog

    Sourced from actions/checkout's changelog.

    Changelog

    v3.1.0

    v3.0.2

    v3.0.1

    v3.0.0

    v2.3.1

    v2.3.0

    v2.2.0

    v2.1.1

    • Changes to support GHES (here and here)

    v2.1.0

    v2.0.0

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/setup-go from 3.3.0 to 3.4.0

    Bump actions/setup-go from 3.3.0 to 3.4.0

    Bumps actions/setup-go from 3.3.0 to 3.4.0.

    Release notes

    Sourced from actions/setup-go's releases.

    Add support for go.work and pass the token input through on GHES

    In scope of this release we added support for go.work file to pass it in go-version-file input.

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-go@v3
        with:
          go-version-file: go.work
      - run: go run hello.go
    

    Besides, we added support to pass the token input through on GHES.

    Fix cache issues and update dependencies

    In scope of this release we fixed the issue with the correct generation of the cache key when the go-version-file input is set (actions/setup-go#267). Moreover, we fixed an issue when the cache folder was not found. Besides, we updated actions/core to 1.10.0 version (actions/setup-go#273).

    Commits
    • d0a58c1 Merge pull request #294 from JamesMGreene/patch-1
    • 3dcd9d6 Update to latest actions/publish-action
    • e983b65 Merge pull request #283 from koba1t/add_support_gowork_for_go-version-file
    • 27b43e1 Pass the token input through on GHES (#277)
    • 7678c83 add support gowork for go-version-file
    • c4a742c fix(): cache resolve version input (#267)
    • f556e5b Merge pull request #273 from rentziass/rentziass/update-actions-core
    • 514ae57 Update @​actions/core to 1.10.0
    • 30b9ddf Merge pull request #264 from e-korolevskii/258-not-throw-err-no-cache-folders
    • c4e1698 prettier format
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/setup-go from 3.3.0 to 3.3.1

    Bump actions/setup-go from 3.3.0 to 3.3.1

    Bumps actions/setup-go from 3.3.0 to 3.3.1.

    Release notes

    Sourced from actions/setup-go's releases.

    Fix cache issues and update dependencies

    In scope of this release we fixed the issue with the correct generation of the cache key when the go-version-file input is set (actions/setup-go#267). Moreover, we fixed an issue when the cache folder was not found. Besides, we updated actions/core to 1.10.0 version (actions/setup-go#273).

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/checkout from 3.0.2 to 3.1.0

    Bump actions/checkout from 3.0.2 to 3.1.0

    Bumps actions/checkout from 3.0.2 to 3.1.0.

    Release notes

    Sourced from actions/checkout's releases.

    v3.1.0

    What's Changed

    New Contributors

    Full Changelog: https://github.com/actions/checkout/compare/v3.0.2...v3.1.0

    Changelog

    Sourced from actions/checkout's changelog.

    v3.1.0

    v3.0.2

    v3.0.1

    v3.0.0

    v2.3.1

    v2.3.0

    v2.2.0

    v2.1.1

    • Changes to support GHES (here and here)

    v2.1.0

    v2.0.0

    v2 (beta)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/setup-go from 3.2.0 to 3.2.1

    Bump actions/setup-go from 3.2.0 to 3.2.1

    Bumps actions/setup-go from 3.2.0 to 3.2.1.

    Release notes

    Sourced from actions/setup-go's releases.

    Update actions/cache version to 3.0.0

    In scope of this release we updated actions/cache package as the new version contains fixes for caching error handling

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump scripts/makefiles/third_party/pasdam/makefiles from `6cf3070` to `f301bb3`

    Bump scripts/makefiles/third_party/pasdam/makefiles from `6cf3070` to `f301bb3`

    Bumps scripts/makefiles/third_party/pasdam/makefiles from 6cf3070 to f301bb3.

    Commits
    • f301bb3 Made possible to override the go package dir, add go install target
    • a8dfa3c Make go build path customizable
    • 2d6ddd4 Make sure go coverage target fails if one of the test does
    • 7980bc6 Add target to upgrade all go mod dependencies
    • See full diff in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/upload-artifact from 2.3.1 to 3

    Bump actions/upload-artifact from 2.3.1 to 3

    Bumps actions/upload-artifact from 2.3.1 to 3.

    Release notes

    Sourced from actions/upload-artifact's releases.

    v3.0.0

    What's Changed

    • Update default runtime to node16 (#293)
    • Update package-lock.json file version to 2 (#302)

    Breaking Changes

    With the update to Node 16, all scripts will now be run with Node 16 rather than Node 12.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/checkout from 3.0.2 to 3.3.0

    Bump actions/checkout from 3.0.2 to 3.3.0

    Bumps actions/checkout from 3.0.2 to 3.3.0.

    Release notes

    Sourced from actions/checkout's releases.

    v3.3.0

    What's Changed

    New Contributors

    Full Changelog: https://github.com/actions/checkout/compare/v3.2.0...v3.3.0

    v3.2.0

    What's Changed

    New Contributors

    Full Changelog: https://github.com/actions/checkout/compare/v3.1.0...v3.2.0

    v3.1.0

    What's Changed

    New Contributors

    Full Changelog: https://github.com/actions/checkout/compare/v3.0.2...v3.1.0

    Changelog

    Sourced from actions/checkout's changelog.

    Changelog

    v3.1.0

    v3.0.2

    v3.0.1

    v3.0.0

    v2.3.1

    v2.3.0

    v2.2.0

    v2.1.1

    • Changes to support GHES (here and here)

    v2.1.0

    v2.0.0

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/setup-go from 3.3.0 to 3.5.0

    Bump actions/setup-go from 3.3.0 to 3.5.0

    Bumps actions/setup-go from 3.3.0 to 3.5.0.

    Release notes

    Sourced from actions/setup-go's releases.

    Add support for stable and oldstable aliases

    In scope of this release we introduce aliases for the go-version input. The stable alias instals the latest stable version of Go. The oldstable alias installs previous latest minor release (the stable is 1.19.x -> the oldstable is 1.18.x).

    Stable

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-go@v3
        with:
          go-version: 'stable'
      - run: go run hello.go
    

    OldStable

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-go@v3
        with:
          go-version: 'oldstable'
      - run: go run hello.go
    

    Add support for go.work and pass the token input through on GHES

    In scope of this release we added support for go.work file to pass it in go-version-file input.

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-go@v3
        with:
          go-version-file: go.work
      - run: go run hello.go
    

    Besides, we added support to pass the token input through on GHES.

    Fix cache issues and update dependencies

    In scope of this release we fixed the issue with the correct generation of the cache key when the go-version-file input is set (actions/setup-go#267). Moreover, we fixed an issue when the cache folder was not found. Besides, we updated actions/core to 1.10.0 version (actions/setup-go#273).

    Commits
    • 6edd440 fix log for stable aliases (#303)
    • 38dbe75 Add stable and oldstable aliases (#300)
    • 30c39bf Merge pull request #301 from jongwooo/chore/use-cache-in-check-dist
    • 8377b69 Use cache in check-dist.yml
    • d0a58c1 Merge pull request #294 from JamesMGreene/patch-1
    • 3dcd9d6 Update to latest actions/publish-action
    • e983b65 Merge pull request #283 from koba1t/add_support_gowork_for_go-version-file
    • 27b43e1 Pass the token input through on GHES (#277)
    • 7678c83 add support gowork for go-version-file
    • c4a742c fix(): cache resolve version input (#267)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump actions/upload-artifact from 3.1.0 to 3.1.1

    Bump actions/upload-artifact from 3.1.0 to 3.1.1

    Bumps actions/upload-artifact from 3.1.0 to 3.1.1.

    Release notes

    Sourced from actions/upload-artifact's releases.

    v3.1.1

    • Update actions/core package to latest version to remove set-output deprecation warning #351
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
gostub is a library to make stubbing in unit tests easy

gostub gostub is a library to make stubbing in unit tests easy. Getting started Import the following package: github.com/prashantv/gostub Click here t

Dec 28, 2022
gomonkey is a library to make monkey patching in unit tests easy

gomonkey is a library to make monkey patching in unit tests easy, and the core idea of monkey patching comes from Bouke, you can read this blogpost for an explanation on how it works.

Jan 4, 2023
Go Interface Mocking Tool

Charlatan Percolate's Go Interface Mocking Tool. Please read our introductory blog post. Installation go get github.com/percolate/charlatan Usage c

Nov 3, 2022
GoMock is a mocking framework for the Go programming language.

gomock GoMock is a mocking framework for the Go programming language. It integrates well with Go's built-in testing package, but can be used in other

Dec 28, 2022
HTTP mocking for Golang

httpmock Easy mocking of http responses from external resources. Install Currently supports Go 1.7 - 1.15. v1 branch has to be used instead of master.

Jan 3, 2023
HTTP mocking to test API services for chaos scenarios
HTTP mocking to test API services for chaos scenarios

GAOS HTTP mocking to test API services for chaos scenarios Gaos, can create and provide custom mock restful services via using your fully-customizable

Nov 5, 2022
A clipboard-based mocking framework for Go that gets out of your way.
A clipboard-based mocking framework for Go that gets out of your way.

A clipboard-based mocking framework for Go that gets out of your way. This tool has been built with inspiration lovingly taken from Moq, and fuelled b

Nov 18, 2022
Lightweight HTTP mocking in Go (aka golang)

httpmock This library builds on Go's built-in httptest library, adding a more mockable interface that can be used easily with other mocking tools like

Dec 16, 2022
Full-featured test framework for Go! Assertions, mocking, input testing, output capturing, and much more! 🍕
Full-featured test framework for Go! Assertions, mocking, input testing, output capturing, and much more! 🍕

testza ?? Testza is like pizza for Go - you could life without it, but why should you? Get The Module | Documentation | Contributing | Code of Conduct

Dec 10, 2022
Interface mocking tool for go generate
Interface mocking tool for go generate

Interface mocking tool for go generate. What is Moq? Moq is a tool that generates a struct from any interface. The struct can be used in test code as

Jan 5, 2023
Random - A Golang library that provides functions for generating random values

Random A Golang library that provides functions for generating random values. Us

Dec 15, 2022
Patch all Go functions for testing
Patch all Go functions for testing

SuperMonkey This lib is inspired by https://github.com/bouk/monkey, and uses some of the code Introduction Patch all functions without limits, includi

Nov 9, 2022
Benchmarking hash functions in Go

Experiment: Benchmarks of Hash Functions in Go This repository contains a small experiment of mine, trying out different hash functions and comparing

Jun 22, 2022
Hive-fleet: a distributed, scalable load-testing tool built in go that leverages Google Cloud Functions

hive-fleet hive-fleet is a distributed, scalable load-testing tool, built on top

Jan 27, 2022
Benchmarking deferent Fibonacci functions and algorithms with running unit test

GoFibonacciBench Benchmarking deferent Fibonacci functions and algorithms with running unit test ... Introduction: Fibonacci numbers are special kinds

Feb 27, 2022
Snapshot - snapshot provides a set of utility functions for creating and loading snapshot files for using snapshot tests.

Snapshot - snapshot provides a set of utility functions for creating and loading snapshot files for using snapshot tests.

Jan 27, 2022
Expressive end-to-end HTTP API testing made easy in Go

baloo Expressive and versatile end-to-end HTTP API testing made easy in Go (golang), built on top of gentleman HTTP client toolkit. Take a look to the

Dec 13, 2022
Quick and easy expression matching for JSON schemas used in requests and responses

schema schema makes it easier to check if map/array structures match a certain schema. Great for testing JSON API's or validating the format of incomi

Dec 24, 2022
Quick and Easy server testing/validation
Quick and Easy server testing/validation

Goss - Quick and Easy server validation Goss in 45 seconds Note: For an even faster way of doing this, see: autoadd Note: For testing docker container

Oct 7, 2022