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

package context: unrecognized import path "context" #899

Closed
siredwin opened this issue Apr 8, 2017 · 1 comment
Closed

package context: unrecognized import path "context" #899

siredwin opened this issue Apr 8, 2017 · 1 comment

Comments

@siredwin
Copy link

siredwin commented Apr 8, 2017

Description

My server hosted in PaaS uses the default provided Go version 1.5.2 . Until recently it ran well and then i started getting the above errors.

package context: unrecognized import path "context"

Problem Origin

Problem arises from the golang/crypto package which requires Go 1.7+. See below commit from 6 days ago.
golang/crypto@88915cc?_pjax=%23js-repo-pjax-container

From the Go 1.7 release notes:

Go 1.7 moves the golang.org/x/net/context package into the standard library as context.

From golang/crypto notes:

acme, acme/autocert: switch to Go 1.7+ context package
The standard library context package has been available since Go 1.7,
and the Go build dashboard (build.golang.org) only tests master and
the past two releases.

Also, the acme package makes no backwards compatibility guarantees,
not that I expect this to influence many people.

Possible Fix

If using Go < 1.7.0
import "golang.org/x/net/context"

If using Go 1.7+
import "context"

For the most part - Just upgrade Go to 1.7+

Caveat

Does labstack echo require Go 1.7+?
I had to make these changes manually in the crypto erratic files but i wish there was a standard way echo or crypto took care of this internally to avoid surprises. I so wish we had a try/except for imports like that.

@vishr
Copy link
Member

vishr commented Apr 10, 2017

Yes Go 1.7+ is recommend.

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

2 participants