Hi I was trying out portgen go, but I didn't have Go installed. As I gather from the source code the program uses Go to determine dependencies. If you try to run portgen go without go installed it produces a number of errors like so:
Can't exec "go": No such file or directory at /usr/ports/infrastructure/lib/OpenBSD/PortGen/Port/Go.pm line 114. Can't exec "go": No such file or directory at /usr/ports/infrastructure/lib/OpenBSD/PortGen/Port/Go.pm line 114. Use of uninitialized value in concatenation (.) or string at /usr/ports/infrastructure/lib/OpenBSD/PortGen/Port/Go.pm line 192. Use of uninitialized value in concatenation (.) or string at /usr/ports/infrastructure/lib/OpenBSD/PortGen/Port/Go.pm line 192. Use of uninitialized value in concatenation (.) or string at /usr/ports/infrastructure/lib/OpenBSD/PortGen/Port/Go.pm line 192. Use of uninitialized value in concatenation (.) or string at /usr/ports/infrastructure/lib/OpenBSD/PortGen/Port/Go.pm line 192. *** Parse error in /usr/ports/mystuff/go/newport: Wrong number of items in for loop (/usr/ports/lang/go/go.port.mk:76) 1 items for 2 variables: couldn't find *** Parse error: Need an operator in 'find' (/usr/ports/lang/go/go.port.mk:76) *** Parse error: Need an operator in 'endfor' (/usr/ports/lang/go/go.port.mk:79) *** Parse error: Wrong number of items in for loop (/usr/ports/lang/go/go.port.mk:80) 1 items for 2 variables: couldn't dist find for *** Parse error: Missing dependency operator (/usr/ports/lang/go/go.port.mk:80) *** Parse error: Need an operator in 'endfor' (/usr/ports/lang/go/go.port.mk:82) <and a few more> This diff implements a very crude search for the go binary, and errors out if it doesn't find it, so now it looks like this: Could not find go executable in PATH at ./portgen line 61. Best, Martin Index: portgen =================================================================== RCS file: /cvs/ports/infrastructure/bin/portgen,v retrieving revision 1.4 diff -u -p -r1.4 portgen --- portgen 2 Jul 2020 21:07:51 -0000 1.4 +++ portgen 19 Mar 2021 09:04:08 -0000 @@ -50,6 +50,18 @@ sub portgen_class if ($@) { die $@; } + if ($type eq "go") { + my $found = 0; + for my $path (split ":", $ENV{PATH}) { + if (-x "$path/go") { + $found = 1; + last; + } + } + unless ($found) { + die "Could not find go executable in PATH"; + } + } return $class; }else { die "unknown module type $type (not in [$types])\n";