Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install doesn't work #99

Closed
leebenson opened this issue Jul 12, 2019 · 5 comments
Closed

Install doesn't work #99

leebenson opened this issue Jul 12, 2019 · 5 comments

Comments

@leebenson
Copy link

Installation instructions in the doc don't work:

go get -u github.com/doug-martin/goqu/v7

Produces:

package github.com/doug-martin/goqu/v7: cannot find package "github.com/doug-martin/goqu/v7" in any of:
	/usr/local/Cellar/go/1.12/libexec/src/github.com/doug-martin/goqu/v7 (from $GOROOT)
	/Users/leebenson/dev/go/src/github.com/doug-martin/goqu/v7 (from $GOPATH)

This does work:

go get -u github.com/doug-martin/goqu

... but then the package paths are messed up, since v7 doesn't exist.

@chen56
Copy link
Contributor

chen56 commented Jul 12, 2019

go mod is ok :

~/temp » go version
go version go1.12.7 darwin/amd64
~/temp » mkdir goqu
~/temp » cd goqu   
~/temp/goqu » go mod init goqu                                                                                                                        
go: creating new go.mod: module goqu
~/temp/goqu » go get -u github.com/doug-martin/goqu/v7                                                                                                
go: finding golang.org/x/net latest
go: finding golang.org/x/crypto latest
go: finding golang.org/x/tools latest
go: finding golang.org/x/sync latest
go: finding golang.org/x/sys latest
------------------------------------------------------------
~/temp/goqu » cat go.mod                                                                                                                              
module goqu

go 1.12

require (
	github.com/doug-martin/goqu/v7 v7.3.0 // indirect
	github.com/golang/protobuf v1.3.2 // indirect
	github.com/stretchr/objx v0.2.0 // indirect
	golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect
	golang.org/x/net v0.0.0-20190628185345-da137c7871d7 // indirect
	golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 // indirect
	golang.org/x/tools v0.0.0-20190711191110-9a621aea19f8 // indirect
)
~/temp/goqu » vim main.go                                                                                                                             
~/temp/goqu » go run main.go                                                                                                                          
SELECT "a", "b" FROM "a" [] <nil>

doug-martin added a commit that referenced this issue Jul 12, 2019
@doug-martin
Copy link
Owner

I added a note to the readme, I've only been using this package with go mod and had not tried it without.

I ran a couple of tests this morning and with any go version >v1.10 I was able to

GO111MODULE=off
go get -u github.com/doug-martin/goqu

And then I ran this as a test to make sure everything was resolving correctly.

package main

import (
	"fmt"

	"github.com/doug-martin/goqu"
	// import the dialect
	_ "github.com/doug-martin/goqu/dialect/mysql"
)

func main() {
	// look up the dialect
	dialect := goqu.Dialect("mysql")

	// use dialect.From to get a dataset to build your SQL
	ds := dialect.From("test").Where(goqu.Ex{"id": 10})
	sql, args, err := ds.ToSQL()
	if err != nil{
		fmt.Println("An error occurred while generating the SQL", err.Error())
	}else{
		fmt.Println(sql, args)
	}

}

What is interesting is the mysql dialect actually imports github.com/doug-martin/goqu/v7 and it resolves just fine within the package and registers the dialect correctly.

Sorry about the confusion and I hope this helps.

@leebenson
Copy link
Author

Thanks @doug-martin. Do you happen to know the fix for using dep?

With this config:

[[constraint]]
  name = "github.com/doug-martin/goqu"
  version = "^v7.3.0"

I get this error:

Solving failure: No versions of github.com/doug-martin/goqu met constraints:
	v7.3.1: "github.com/doug-martin/goqu" imports "github.com/doug-martin/goqu/v7/exec", which contains malformed code: no package exists at "github.com/doug-martin/goqu/v7/exec"
	v7.3.0: "github.com/doug-martin/goqu" imports "github.com/doug-martin/goqu/v7/internal/sb", which contains malformed code: no package exists at "github.com/doug-martin/goqu/v7/internal/sb"
	v7.2.0: Could not introduce github.com/doug-martin/goqu@v7.2.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v7.1.0: Could not introduce github.com/doug-martin/goqu@v7.1.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v7.0.1: Could not introduce github.com/doug-martin/goqu@v7.0.1, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v7.0.0: Could not introduce github.com/doug-martin/goqu@v7.0.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v6.1.0: Could not introduce github.com/doug-martin/goqu@v6.1.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v6.0.0: Could not introduce github.com/doug-martin/goqu@v6.0.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v5.0.0: Could not introduce github.com/doug-martin/goqu@v5.0.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v4.2.0: Could not introduce github.com/doug-martin/goqu@v4.2.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v4.1.0: Could not introduce github.com/doug-martin/goqu@v4.1.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v4.0.0: Could not introduce github.com/doug-martin/goqu@v4.0.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v3.3: Could not introduce github.com/doug-martin/goqu@v3.3, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v3.2: Could not introduce github.com/doug-martin/goqu@v3.2, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v3.1.3: Could not introduce github.com/doug-martin/goqu@v3.1.3, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v3.1.2: Could not introduce github.com/doug-martin/goqu@v3.1.2, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v3.1.1: Could not introduce github.com/doug-martin/goqu@v3.1.1, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v3.1.0: Could not introduce github.com/doug-martin/goqu@v3.1.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v3.0.1: Could not introduce github.com/doug-martin/goqu@v3.0.1, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v3.0.0: Could not introduce github.com/doug-martin/goqu@v3.0.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v2.0.3: Could not introduce github.com/doug-martin/goqu@v2.0.3, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v2.0.2: Could not introduce github.com/doug-martin/goqu@v2.0.2, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v2.0.1: Could not introduce github.com/doug-martin/goqu@v2.0.1, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v2.0.0: Could not introduce github.com/doug-martin/goqu@v2.0.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v1.0.0: Could not introduce github.com/doug-martin/goqu@v1.0.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v0.3.1: Could not introduce github.com/doug-martin/goqu@v0.3.1, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v0.3.0: Could not introduce github.com/doug-martin/goqu@v0.3.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v0.2.0: Could not introduce github.com/doug-martin/goqu@v0.2.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v0.1.1: Could not introduce github.com/doug-martin/goqu@v0.1.1, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v0.1.0: Could not introduce github.com/doug-martin/goqu@v0.1.0, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v0.0.2: Could not introduce github.com/doug-martin/goqu@v0.0.2, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v0.0.1: Could not introduce github.com/doug-martin/goqu@v0.0.1, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	master: Could not introduce github.com/doug-martin/goqu@master, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	fix-reflect-val-assign: Could not introduce github.com/doug-martin/goqu@fix-reflect-val-assign, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	gh-pages: Could not introduce github.com/doug-martin/goqu@gh-pages, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	nil-time: Could not introduce github.com/doug-martin/goqu@nil-time, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	pg_arrays: Could not introduce github.com/doug-martin/goqu@pg_arrays, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	rename_column_function: Could not introduce github.com/doug-martin/goqu@rename_column_function, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	upsert_changelog: Could not introduce github.com/doug-martin/goqu@upsert_changelog, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v6.0.0-rc: Could not introduce github.com/doug-martin/goqu@v6.0.0-rc, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v6.1.0-rc: Could not introduce github.com/doug-martin/goqu@v6.1.0-rc, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v7.0.0-rc: Could not introduce github.com/doug-martin/goqu@v7.0.0-rc, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v7.1.0-rc: Could not introduce github.com/doug-martin/goqu@v7.1.0-rc, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v7.1.1-rc: Could not introduce github.com/doug-martin/goqu@v7.1.1-rc, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v7.2.0-rc: Could not introduce github.com/doug-martin/goqu@v7.2.0-rc, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v7.3.0-rc: Could not introduce github.com/doug-martin/goqu@v7.3.0-rc, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].
	v7.3.1: Could not introduce github.com/doug-martin/goqu@v7.3.1, as it is not allowed by constraint ^7.3.0 from project github.com/[hidden].

@doug-martin
Copy link
Owner

@leebenson I havent tried to use it with dep yet. I'm out for the next week, so it will be a little bit before I can try it out. If you happen to figure it out if you could reply with your solution or create a PR adding instructions to the README and I will get that merged.

@leebenson
Copy link
Author

Thanks @doug-martin. We've internally switched to using modules, so this is no longer relevant to us, but I appreciate you looking into it. Will close for now.

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

No branches or pull requests

3 participants