Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

buffalo >= 0.16.26 breaks when vendoring is used #32

Closed
artem-sidorenko opened this issue Aug 13, 2021 · 11 comments
Closed

buffalo >= 0.16.26 breaks when vendoring is used #32

artem-sidorenko opened this issue Aug 13, 2021 · 11 comments
Assignees

Comments

@artem-sidorenko
Copy link

Description

gobuffalo/buffalo#2119 introduced go get -d during buffalo build. aa.go, created during buffalo build contains flect (which isn't a direct import in the application). Because of go get -d this leads to the modified go.mod with explicit dependency and to a mismatch with vendor/modules.txt with following error message:

go: inconsistent vendoring in /home/vagrant/artem:
	github.com/gobuffalo/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt

	To ignore the vendor directory, use -mod=readonly or -mod=mod.
	To sync the vendor directory, run:
		go mod vendor

If you add flect manually to the go.mod, it will vanish by the next go mod tidy.

Current workaround is to add _ "github.com/gobuffalo/flect" to the import in main.go (or somewhere else) and run go mod vendor

Steps to Reproduce the Problem

  1. get buffalo cmd 0.17.1
  2. create new application
  3. build it buffalo build -v - it works
  4. enable vendoring with go mod vendor
  5. build it again with buffalo build -v - it breaks
# setup buffalo cmd 0.17.1/0.17.2
 $ git clone https://github.com/gobuffalo/cli.git 
 $ cd cli 
 $ git checkout v0.17.1
 $ go mod tidy
 $ cd cmd/buffalo/ 
 $ go build -tags sqlite 
 $ mv buffalo /usr/local/go/bin/

# create new application
$ buffalo new testapp
...
$ cd testapp
$ buffalo build -v   # it works!
....

# enable vendoring and build again
$ go mod vendor
$ buffalo build -v
...
go: inconsistent vendoring in /home/vagrant/testapp:
	github.com/gobuffalo/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt

	To ignore the vendor directory, use -mod=readonly or -mod=mod.
	To sync the vendor directory, run:
		go mod vendor
...

I could reproduce it on buffalo cmd >= 0.16.26 and on the latest 0.17.1

Expected Behavior

buffalo should support vendoring

Actual Behavior

buffalo doesn't build when vendoring is enabled

Info

Please run buffalo info and paste the information below where it says "PASTE_HERE".

-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/local/go/bin/go

-> Go: Checking minimum version requirements
✓ Your version of Go, 1.16.7, meets the minimum requirements.

-> Go: Checking Package Management
✓ You are using Go Modules (`go`) for package management.

-> Go: Checking PATH
✓ Your PATH contains /home/vagrant/go/bin.

-> Node: Checking installation
✓ The `node` executable was found on your system at: /bin/node

-> Node: Checking minimum version requirements
✓ Your version of Node, v14.17.5, meets the minimum requirements.

-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /bin/npm

-> NPM: Checking minimum version requirements
✓ Your version of NPM, 6.14.14, meets the minimum requirements.

-> Yarn: Checking installation
✓ The `yarnpkg` executable was found on your system at: /bin/yarnpkg

-> Yarn: Checking minimum version requirements
✓ Your version of Yarn, 1.22.11, meets the minimum requirements.

-> PostgreSQL: Checking installation
✘ The `postgres` executable could not be found on your system.
For help setting up your Postgres environment please follow the instructions for you platform at:

https://www.postgresql.org/download/

-> MySQL: Checking installation
✘ The `mysql` executable could not be found on your system.
For help setting up your MySQL environment please follow the instructions for you platform at:

https://www.mysql.com/downloads/

-> SQLite3: Checking installation
✓ The `sqlite3` executable was found on your system at: /bin/sqlite3

-> SQLite3: Checking minimum version requirements
✓ Your version of SQLite3, 3.7.17, meets the minimum requirements.

-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:

https://www.cockroachlabs.com/docs/stable/

-> Buffalo (CLI): Checking installation
✓ The `buffalo` executable was found on your system at: /usr/local/go/bin/buffalo

-> Buffalo (CLI): Checking minimum version requirements
✘ Invalid Semantic Version

-> Buffalo: Application Details
Pwd         /home/vagrant/testapp
Root        /home/vagrant/testapp
GoPath      /home/vagrant/go
PackagePkg  testapp
ActionsPkg  testapp/actions
ModelsPkg   testapp/models
GriftsPkg   testapp/grifts
WithModules true
Name        testapp
Bin         bin/testapp
VCS         git
WithPop     true
WithSQLite  false
WithDep     false
WithWebpack true
WithNodeJs  true
WithYarn    true
WithDocker  true
WithGrifts  true
AsWeb       true
AsAPI       false
InApp       true
PackageJSON {map[build:webpack -p --progress dev:webpack --watch]}

-> Buffalo: config/buffalo-app.toml
name = "testapp"
bin = "bin/testapp"
vcs = "git"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = true
with_nodejs = true
with_yarn = true
with_docker = true
with_grifts = true
as_web = true
as_api = false

-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v2"

-> Buffalo: go.mod
module testapp

go 1.16

require (
	github.com/gobuffalo/buffalo v0.17.2
	github.com/gobuffalo/buffalo-pop/v2 v2.3.0
	github.com/gobuffalo/envy v1.9.0
	github.com/gobuffalo/mw-csrf v1.0.0
	github.com/gobuffalo/mw-forcessl v0.0.0-20200131175327-94b2bd771862
	github.com/gobuffalo/mw-i18n v1.1.0
	github.com/gobuffalo/mw-paramlogger v1.0.0
	github.com/gobuffalo/packr/v2 v2.8.1
	github.com/gobuffalo/pop/v5 v5.3.4
	github.com/gobuffalo/suite v2.8.2+incompatible
	github.com/markbates/grift v1.5.0
	github.com/unrolled/secure v1.0.9
)
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@artem-sidorenko
Copy link
Author

@paganotoni any idea on the direction how this might be resolved?

@paganotoni
Copy link
Member

paganotoni commented Sep 19, 2021

Hey @artem-sidorenko. Let me take a look at this one over the week. Thanks for following up. I'm moving it to the CLI repo.

@paganotoni paganotoni reopened this Sep 19, 2021
@paganotoni paganotoni transferred this issue from gobuffalo/buffalo Sep 19, 2021
@paganotoni paganotoni self-assigned this Sep 30, 2021
@paganotoni
Copy link
Member

I tried this one with latest version but it worked. @artem-sidorenko can you try installing latest CLI version and retrying? Thanks in advance.

@artem-sidorenko
Copy link
Author

@paganotoni Thx! I can confirm, it looks good on v0.17.5

@pycak
Copy link

pycak commented Jan 31, 2022

@paganotoni the same issue in version is v0.18.2 back

go: inconsistent vendoring in [/Users/pycak/workspace/T-Systems/DTSPv2/apps/backend/core:](url)
	github.com/gobuffalo/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt

	To ignore the vendor directory, use -mod=readonly or -mod=mod.
	To sync the vendor directory, run:
		go mod vendor

@fasmat
Copy link
Member

fasmat commented Jan 31, 2022

@paganotoni: the only fix I see is to call go mod vendor after creating the aa package and again after deleting it.

I think this defeats the purpose of the vendor directory? I'm not sure, since go modules where introduced I haven't used vendor any more.

@github-actions
Copy link

github-actions bot commented Mar 3, 2022

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

github-actions bot commented Mar 9, 2022

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as completed Mar 9, 2022
@artem-sidorenko
Copy link
Author

@paganotoni @fasmat in the current behavior (buffalo 0.18.4) it works without the hack for the unit tests, but breaks for the build

any chance to see here an idea how this might be resolved? I'm wondering there are no other bug reports on this..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants