Skip to content

Organize imports on save will add slog from "golang.org/x/exp/slog" instead of "log/slog" #2996

Answered by ousloob
jurisevo asked this question in Help
Discussion options

You must be logged in to vote

@jurisevo
You can handle this in two ways:

On VS Code, add this to your settings.json:

{
    "gopls": {
        "importShortcut": "Definition"
    }
}    

Alternatively, you can remove the experimental package by running go get -d golang.org/x/exp/slog@none followed by go mod tidy. This will clean up your dependencies and force the usage of the standard library version from log/slog. Make sure to update your imports from golang.org/x/exp/slog to log/slog in your code.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jurisevo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants