Skip to content

package context: unrecognized import path "context" #899

Closed
@siredwin

Description

@siredwin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions