Skip to content

Go generate cannot modify pkg cache directory. #5

@hungrymonkey

Description

@hungrymonkey

Steps to reproduce the bug

  1. Setup a project that requires cgo shared libraries
  2. go generate

Description:

go-ladybug download lbug.h as a readonly file. download_lbug.sh cannot copy lbug.h into the cache directory.

Expected results:

The script succeed.

Actual results.

download_lbug.sh script fails

go generate ./...
🔍 Detected OS: osx, Architecture: aarch64
📦 Downloading asset: liblbug-osx-universal.tar.gz
   Downloading from: https://github.com/LadybugDB/ladybug/releases/latest/download/liblbug-osx-universal.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 9244k  100 9244k    0     0  21.1M      0 --:--:-- --:--:-- --:--:-- 21.1M
cp: /Users/ted/go/pkg/mod/github.com/!ladybug!d!b/go-ladybug@v0.13.1/lbug.h: Permission denied
cgo_shared.go:3: running "sh": exit status 1
main.go:3: running "sh": exit status 1
 go generate
++ uname -s
+ os=Darwin
+ case $os in
+ os=osx
++ uname -m
+ arch=arm64
+ case $arch in
+ arch=aarch64
+ '[' osx = osx ']'
+ asset=liblbug-osx-universal.tar.gz
+ ext=tar.gz
+ echo '🔍 Detected OS: osx, Architecture: aarch64'
🔍 Detected OS: osx, Architecture: aarch64
+ echo '📦 Downloading asset: liblbug-osx-universal.tar.gz'
📦 Downloading asset: liblbug-osx-universal.tar.gz
++ mktemp -d
+ temp_dir=/var/folders/v1/6wdw86q9739_sw6ymfkp0lpm0000gn/T/tmp.sRkl1C0Gd8
+ cd /var/folders/v1/6wdw86q9739_sw6ymfkp0lpm0000gn/T/tmp.sRkl1C0Gd8
+ download_url=https://github.com/LadybugDB/ladybug/releases/latest/download/liblbug-osx-universal.tar.gz
+ echo '   Downloading from: https://github.com/LadybugDB/ladybug/releases/latest/download/liblbug-osx-universal.tar.gz'
   Downloading from: https://github.com/LadybugDB/ladybug/releases/latest/download/liblbug-osx-universal.tar.gz
+ command -v curl
+ curl -L -o liblbug-osx-universal.tar.gz https://github.com/LadybugDB/ladybug/releases/latest/download/liblbug-osx-universal.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 9244k  100 9244k    0     0  24.9M      0 --:--:-- --:--:-- --:--:-- 24.9M
+ '[' tar.gz = tar.gz ']'
+ tar -xzf liblbug-osx-universal.tar.gz
++ find . -name lbug.h
++ head -1
+ lbug_file=./lbug.h
+ '[' -n ./lbug.h ']'
+ cp ./lbug.h '/Users/ted/go/pkg/mod/github.com/!ladybug!d!b/go-ladybug@v0.13.1'
 ls -l /Users/ted/go/pkg/mod/github.com/\!ladybug\!d\!b/go-ladybug@v0.13.1 
total 448
-r--r--r--  1 ted  staff    485 Dec 23 13:15 cgo_shared.go
-r--r--r--  1 ted  staff    708 Dec 23 13:15 CODE_OF_CONDUCT.md
-r--r--r--  1 ted  staff   4044 Dec 23 13:15 connection_test.go
-r--r--r--  1 ted  staff   5514 Dec 23 13:15 connection.go
-r--r--r--  1 ted  staff   2058 Dec 23 13:15 CONTRIBUTING.md
-r--r--r--  1 ted  staff   2508 Dec 23 13:15 database_test.go
-r--r--r--  1 ted  staff   3170 Dec 23 13:15 database.go
dr-xr-xr-x  4 ted  staff    128 Dec 23 13:15 dataset
-r--r--r--  1 ted  staff   1705 Dec 23 13:15 download_lbug.sh
-r--r--r--  1 ted  staff   2385 Dec 23 13:15 driver_test.go
-r--r--r--  1 ted  staff   7306 Dec 23 13:15 driver.go
-r--r--r--  1 ted  staff   2458 Dec 23 13:15 flat_tuple_test.go
-r--r--r--  1 ted  staff   2315 Dec 23 13:15 flat_tuple.go
-r--r--r--  1 ted  staff    323 Dec 23 13:15 go.mod
-r--r--r--  1 ted  staff   1221 Dec 23 13:15 go.sum
-r--r--r--  1 ted  staff   2670 Dec 23 13:15 helper_test.go
-r--r--r--  1 ted  staff  71582 Dec 23 13:15 lbug.h
-r--r--r--  1 ted  staff   1072 Dec 23 13:15 LICENSE
-r--r--r--  1 ted  staff   8332 Dec 23 13:15 parameter_test.go
-r--r--r--  1 ted  staff    713 Dec 23 13:15 prepared_statement.go
-r--r--r--  1 ted  staff   4775 Dec 23 13:15 query_result_test.go
-r--r--r--  1 ted  staff   4819 Dec 23 13:15 query_result.go
-r--r--r--  1 ted  staff   2707 Dec 23 13:15 README.md
-r--r--r--  1 ted  staff   2247 Dec 23 13:15 time_helper.go
-r--r--r--  1 ted  staff  22306 Dec 23 13:15 value_helper.go
-r--r--r--  1 ted  staff  14547 Dec 23 13:15 value_test.go

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions