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

use gopkg.in to make buildable with go modules and dep #20

Closed
wants to merge 1 commit into from

Conversation

markbates
Copy link

Currently when trying to use this package with either Go modules in 1.11 or in a dep environment, the package doesn't build. This change uses the gopkg.in version of the russross/blackfriday project to ensure that the correct version of blackfriday is used.

@dmitshur
Copy link
Member

dmitshur commented Aug 7, 2018

Thanks for reporting this and sending the PR. (Please ignore the CI failure, it happens due to a current Travis CI issue.) I'd like to investigate and understand the issue better.

Can you post the commands for building this with modules in Go 1.11 and the output you get? Is it just go build, or are there some environment variables involved? The build succeeds for me with Go 1.11 Beta 3:

$ go1.11beta3 version
go version go1.11beta3 darwin/amd64
$ go1.11beta3 build github.com/shurcooL/github_flavored_markdown
$

According to https://github.com/russross/blackfriday#versions, the canonical import path of blackfriday v1 is github.com/russross/blackfriday.

@markbates
Copy link
Author

I'm still trying to get a simple reproducible test case for modules. They don't quite work in what I could predictable way yet. :)

When working on getting Buffalo to use Go modules I do occasionally get this:

github.com/shurcooL/github_flavored_markdown
# github.com/shurcooL/github_flavored_markdown
../../../../../development/gocode/pkg/mod/github.com/shurcoo!l/github_flavored_markdown@v0.0.0-20180602233135-8913699a52e3/main.go:71:7: const initializer blackfriday.EXTENSION_NO_INTRA_EMPHASIS | blackfriday.EXTENSION_TABLES | blackfriday.EXTENSION_FENCED_CODE | blackfriday.EXTENSION_AUTOLINK | blackfriday.EXTENSION_STRIKETHROUGH | blackfriday.EXTENSION_SPACE_HEADERS | blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK is not a constant
../../../../../development/gocode/pkg/mod/github.com/shurcoo!l/github_flavored_markdown@v0.0.0-20180602233135-8913699a52e3/main.go:71:20: undefined: blackfriday.EXTENSION_NO_INTRA_EMPHASIS
../../../../../development/gocode/pkg/mod/github.com/shurcoo!l/github_flavored_markdown@v0.0.0-20180602233135-8913699a52e3/main.go:72:2: undefined: blackfriday.EXTENSION_TABLES
../../../../../development/gocode/pkg/mod/github.com/shurcoo!l/github_flavored_markdown@v0.0.0-20180602233135-8913699a52e3/main.go:73:2: undefined: blackfriday.EXTENSION_FENCED_CODE
../../../../../development/gocode/pkg/mod/github.com/shurcoo!l/github_flavored_markdown@v0.0.0-20180602233135-8913699a52e3/main.go:74:2: undefined: blackfriday.EXTENSION_AUTOLINK
../../../../../development/gocode/pkg/mod/github.com/shurcoo!l/github_flavored_markdown@v0.0.0-20180602233135-8913699a52e3/main.go:75:2: undefined: blackfriday.EXTENSION_STRIKETHROUGH
../../../../../development/gocode/pkg/mod/github.com/shurcoo!l/github_flavored_markdown@v0.0.0-20180602233135-8913699a52e3/main.go:76:2: undefined: blackfriday.EXTENSION_SPACE_HEADERS
../../../../../development/gocode/pkg/mod/github.com/shurcoo!l/github_flavored_markdown@v0.0.0-20180602233135-8913699a52e3/main.go:77:2: undefined: blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK
../../../../../development/gocode/pkg/mod/github.com/shurcoo!l/github_flavored_markdown@v0.0.0-20180602233135-8913699a52e3/main.go:93:2: undefined: blackfriday.Html

Again, still working on a small repo test case.

As for dep, its very easy to reproduce:

package main

import _ "github.com/shurcooL/github_flavored_markdown"

func main() {}
$ dep init
$ go build
# github.com/gobuffalo/gfmd/vendor/github.com/shurcooL/github_flavored_markdown
vendor/github.com/shurcooL/github_flavored_markdown/main.go:71:7: const initializer blackfriday.EXTENSION_NO_INTRA_EMPHASIS | blackfriday.EXTENSION_TABLES | blackfriday.EXTENSION_FENCED_CODE | blackfriday.EXTENSION_AUTOLINK | blackfriday.EXTENSION_STRIKETHROUGH | blackfriday.EXTENSION_SPACE_HEADERS | blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK is not a constant
vendor/github.com/shurcooL/github_flavored_markdown/main.go:71:20: undefined: blackfriday.EXTENSION_NO_INTRA_EMPHASIS
vendor/github.com/shurcooL/github_flavored_markdown/main.go:72:2: undefined: blackfriday.EXTENSION_TABLES
vendor/github.com/shurcooL/github_flavored_markdown/main.go:73:2: undefined: blackfriday.EXTENSION_FENCED_CODE
vendor/github.com/shurcooL/github_flavored_markdown/main.go:74:2: undefined: blackfriday.EXTENSION_AUTOLINK
vendor/github.com/shurcooL/github_flavored_markdown/main.go:75:2: undefined: blackfriday.EXTENSION_STRIKETHROUGH
vendor/github.com/shurcooL/github_flavored_markdown/main.go:76:2: undefined: blackfriday.EXTENSION_SPACE_HEADERS
vendor/github.com/shurcooL/github_flavored_markdown/main.go:77:2: undefined: blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK
vendor/github.com/shurcooL/github_flavored_markdown/main.go:93:2: undefined: blackfriday.Html

dmitshur added a commit that referenced this pull request Sep 23, 2018
The intention is to make it so that it's possible to import and use
this package from within Go modules (in addition to the well-supported
GOPATH workspace mode), and have it build without users having to
manually specify that github_flavored_markdown requires blackfriday v1.

Use the recently created v1.5.2 tag.

Only specify the blackfriday version in go.mod and go.sum; others are
unspecified to avoid the added burden of maintaining and updating them.

Closes #20.
@dmitshur
Copy link
Member

Okay, I can reproduce with modules. I have an alternate fix in mind, please take a look at #22 and let me know what you think.

@markbates
Copy link
Author

markbates commented Sep 23, 2018 via email

dmitshur added a commit that referenced this pull request Sep 23, 2018
The intention is to make it so that it's possible to import and use
this package from within Go modules (in addition to the well-supported
GOPATH workspace mode), and have it build without users having to
manually specify that github_flavored_markdown requires blackfriday v1.

Use the recently created blackfriday v1.5.2 tag.

Only specify the blackfriday version in go.mod and go.sum; others are
unspecified to avoid the added burden of maintaining and updating them.

Fixes #12.
Closes #20.
@rtfb
Copy link

rtfb commented Sep 24, 2018

Wouldn't a Gopkg.toml with a constraint solve this for dep?

[[constraint]]
  name = "github.com/russross/blackfriday"
  version = "<2.0.0"

dmitshur added a commit that referenced this pull request Oct 2, 2018
The intention is to make it so that it's possible to import and use
this package from within Go modules (in addition to the well-supported
GOPATH workspace mode), and have it build without users having to
manually specify that github_flavored_markdown requires blackfriday v1.

Use the recently created blackfriday v1.5.2 tag.

Only specify the blackfriday version in go.mod and go.sum; others are
unspecified to avoid the added burden of maintaining and updating them.

Updates #12.
Updates #20.
@markbates markbates closed this Nov 10, 2018
@markbates markbates deleted the fix-blackfriday branch November 10, 2018 15:27
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

Successfully merging this pull request may close these issues.

3 participants