Skip to content
This repository has been archived by the owner on Jun 25, 2022. It is now read-only.

use packr2 in command line #303

Closed
TQuy opened this issue Jun 25, 2022 · 1 comment
Closed

use packr2 in command line #303

TQuy opened this issue Jun 25, 2022 · 1 comment

Comments

@TQuy
Copy link

TQuy commented Jun 25, 2022

I am new in golang and currently being stuck at this tutorial https://golangbot.com/read-files/, my OS is ubuntu 22.04, golang version is 1.18
If I get packr with

go get -u github.com/gobuffalo/packr/v2/...

I receive this error when running packr2 in command line

Command 'packr2' not found, but can be installed with:
sudo snap install packr2

I tried

go install github.com/gobuffalo/packr/[email protected]

but receive this error

package github.com/gobuffalo/packr/v2 is not a main package

I watched https://vimeo.com/219863271 but there is no step of getting packr command. I checked and there is packr2 library in snap store. Do I have to install it with snap?

@sio4
Copy link
Member

sio4 commented Jun 25, 2022

Hi @TQuy,

It seems like the document you are referring to is somewhat outdated from some perspectives:

  1. When installing a module with a command, in go1.18, the old method go get is deprecated. (see [1]) You can use the following command:

    go install github.com/gobuffalo/packr/v2/packr2@latest

    For the command installation, as your error message told you, the path to the main package should be provided as an argument for the install command and the path for the packr2 is like above.

  2. More important change (for us): Packr was deprecated and not maintained now. For the (almost) same purpose of the file embedding, now you can use the go standard library's embed package so no more third-party packages are required for the file embedding. (see [2])

    All buffalo families are also migrated to the standard embed, and this repository will be archived soon. :-)

[1] https://tip.golang.org/doc/go1.18#go-get:~:text=go%20get%20no%20longer%20builds%20or%20installs%20packages%20in%20module%2Daware%20mode.
[2] https://pkg.go.dev/embed

@sio4 sio4 closed this as completed Jun 25, 2022
@sio4 sio4 pinned this issue Jun 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants