golang icon indicating copy to clipboard operation
golang copied to clipboard

Packages installation not working starting golang 1.18

Open visheyra opened this issue 3 years ago • 2 comments

:speaking_head: Foreword

:ghost: Brief Description

When using the go 1.18 version, the package installation is no longer working because packages cannot be installed globally using go get leading to this error message:

         go: go.mod file not found in current directory or any parent directory.
    	'go get' is no longer supported outside a module.
    	To build and install a command, use 'go install' with a version,
    	like 'go install example.com/cmd@latest'
    	For more information, see https://golang.org/doc/go-get-install-deprecation
    	or run 'go help get' or 'go help install'.

:pancakes: Cookbook version

version is 5.3.2 but this will fail in any version

:woman_cook: Chef-Infra Version

chef version is 17.9.46 but this is not related.

:tophat: Platform details

Operating system distribution and release version. Cloud provider if running in the cloud.

Steps To Reproduce

Steps to reproduce the behavior:

with a recipe using this cookbook:

  • specify go 1.18 or above (in my case 1.18.1)
  • specify a package to be installed using the node_attributes (in my case golangcilint)
  • run chef on the instance and see the error message

:police_car: Expected behavior

I expect the package that I specified in node attributes being installed globally without failure

:heavy_plus_sign: Additional context

I'm trying to make a pr to fix this issue, however I'm kind of a noob in ruby/chef so I might have questions :)

visheyra avatar May 23 '22 10:05 visheyra

first version here :) https://github.com/sous-chefs/golang/pull/105 waiting for your feedback, I'm checking to make the CI pass now

visheyra avatar May 23 '22 11:05 visheyra

I'm not sure about the upgrade part, it looks like package installed by go install are frost and only changing the version and requiring a new go install is the way to do, unless using gup to manage those. Also it looks like version are mandatory now, How do you want to handle those cases ?

visheyra avatar May 23 '22 11:05 visheyra