unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Marc <marc@coquand.email>
To: help-guix@gnu.org
Subject: Go build system - build from local directory fails
Date: Wed, 18 Dec 2024 12:01:12 +0100	[thread overview]
Message-ID: <87y10dntl3.fsf@coquand.email> (raw)


Hey,

I'm trying to build a go program that is located locally, and figured
I'd use to go-build-system to do so. I've created the following

(use-modules (guix gexp)
	     (guix packages)
	     (gnu packages gcc)
	     (gnu packages golang)    
	     (guix build-system go)
	     (guix git-download)
	     (guix utils)
	     (guix download)
	     (guix build-system go)
	     (gnu packages bash))

(define (vcs-file? file stat)
  "Return #t if file is a version-controlled file."
  (case (stat:type stat)
    ((directory)
     (member (basename file) '(".bzr" ".git" ".hg" ".svn" "CVS")))
    ((regular)
     ;; Git sub-modules have a '.git' file that is a regular text file.
     (string=? (basename file) ".git"))
    (else
     #f)))

(define %script-name "my-project")

(package
 (name %script-name)
 (version "0.1")
 (source (local-file "." %script-name
		     #:recursive? #t
		     #:select? vcs-file?))
 (build-system go-build-system)
 (home-page #f)
 (synopsis "")
 (description "")
 (license #f))

Which I attempted to invoke with ~guix build -f myfile.scm~ but I get
errors. The program builds without issue otherwise, but here I get the error:

command "go" "install" "-v" "-x" "-ldflags=-s -w" "-trimpath" "" failed with status 1

An initial suspicion is that I haven't set ‘#:import-path’ as expected
in the documentation. However, all examples I can find of this are
builds from a github repository rather than a local file, so I am not
sure what it needs to be set to.

Any clue what I could be missing?

Cheers, 
-- 
Marc


             reply	other threads:[~2024-12-18 11:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 11:01 Marc [this message]
2024-12-22  6:12 ` Go build system - build from local directory fails Marek Paśnikowski
2024-12-23 20:44   ` Leo Famulari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y10dntl3.fsf@coquand.email \
    --to=marc@coquand.email \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).