Need Help Porting Gravitational Teleport (at least the client for now)

I have the following so far:

Code:
PORTNAME=    teleport
DISTVERSIONPREFIX=    v
DISTVERSION=    17.3.0
CATEGORIES=    shells
PKGNAMEPREFIX=    gravitational-

MASTER_SITES+=    https://raw.githubusercontent.com/${GH_ACCOUNT}/${PORTNAME}/${DISTVERSIONFULL}/:gomod
DISTFILES=    go.mod:gomod

MAINTAINER=    ports@freebsd.org
COMMENT=    The easiest, and most secure way to access and protect all of your infrastructure.
WWW=        https://github.com/gravitational/teleport

LICENSE=    AGPLv3
LICENSE_FILE=    ${WRKSRC}/LICENSE

USES=        go:1.23,modules
USE_GITHUB=    yes
GH_ACCOUNT=    gravitational
GO_MODULE=    github.com/gravitational/${PORTNAME}/v17
GO_TARGET=    ./tool/tsh

PLIST_SUB=    ${SUB_LIST}

.include <bsd.port.mk>

There's a slight bug that I'm not worrying about at the moment:

Code:
go: github.com/gravitational/teleport/api@v0.0.0 (replaced by ./api): reading api/go.mod: open /usr/ports/distfiles/go/shells_teleport/gravitational-teleport-v17.3.0_GH0/api/go.mod: no such file or directory

Just extract the `api` folder from the tar archive and put it where it's expected. (if you know how to fix this, please share :))

The problem I need help with is with a Linuxism. I know very little about GoLang (and want to keep it that way). There appears to be a system call being made that doesn't exist on FreeBSD:

Code:
===>  Building tsh from ./tool/tsh
github.com/gravitational/teleport/lib/utils
# github.com/gravitational/teleport/lib/utils
lib/utils/disk.go:127:20: undefined: syscall.S_IWGRP
lib/utils/disk.go:128:18: undefined: syscall.S_IXGRP
lib/utils/disk.go:136:18: undefined: syscall.S_IWOTH
lib/utils/disk.go:137:16: undefined: syscall.S_IXOTH
*** Error code 1

There doesn't seem to be any "prior art" in the form of patches from other ports. Or at least I just don't understand how to translate them to this specific case.
 
just replace them by hand with values from sys/stat.h (those are defined in octal which im not sure will work in go but you can use the hex values)
 
Code:
===>  Building tsh from ./tool/tsh
github.com/gravitational/teleport/lib/utils
# github.com/gravitational/teleport/lib/utils
lib/utils/disk.go:127:20: undefined: syscall.S_IWGRP
lib/utils/disk.go:128:18: undefined: syscall.S_IXGRP
lib/utils/disk.go:136:18: undefined: syscall.S_IWOTH
lib/utils/disk.go:137:16: undefined: syscall.S_IXOTH
*** Error code 1

That looks uglee, as in heavy Linux/glibc bonding. Can you look up these symbols in the code and post how they are used?
 
That looks uglee, as in heavy Linux/glibc bonding. Can you look up these symbols in the code and post how they are used?

Hmm... looks like I can either do what the AI is suggesting, which is to replace the logic with the `os/access` package. Or I can do what they did on the windows version and just return a noop


Code:
// CanUserWriteTo attempts to check if a user has write access to certain path.
// It also works around the program being run as root and tries to check
// the permissions of the user who executed the program as root.
// This should only be used for string formatting or inconsequential use cases
// as it's not bullet proof and can report wrong results.
func CanUserWriteTo(path string) (bool, error) {
...
            if perm&syscall.S_IWGRP != 0 &&
                perm&syscall.S_IXGRP != 0 {
                return true, nil
            }
...
    // file has o+wx permissions
    if perm&syscall.S_IWOTH != 0 &&
        perm&syscall.S_IXOTH != 0 {
        return true, nil
    }
...
}

I don't even think this function is all that important for the Teleport client. I think I might try the noop approach first to get past this and see what else might need some patching.
 
Wow, it compiled (after some hacking). Now I need to see if my "hacks" broke functionality.

Code:
make makepatch
Generated patch-lib_sshutils_scp_local.go
Generated patch-lib_sshutils_sftp_sftp.go
Generated patch-lib_utils_disk.go

cat files/*.go
--- lib/sshutils/scp/local.go.orig    2025-02-28 20:13:31 UTC
+++ lib/sshutils/scp/local.go
@@ -104,7 +104,7 @@ func makeFileInfo(filePath string) (FileInfo, error) {
     return &localFileInfo{
         filePath:   filePath,
         fileInfo:   f,
-        accessTime: GetAtime(f),
+        accessTime: f.ModTime(),
     }, nil
 }
 
--- lib/sshutils/sftp/sftp.go.orig    2025-02-28 20:13:31 UTC
+++ lib/sshutils/sftp/sftp.go
@@ -42,7 +42,7 @@ import (
 
     "github.com/gravitational/teleport"
     "github.com/gravitational/teleport/lib/defaults"
-    "github.com/gravitational/teleport/lib/sshutils/scp"
+//    "github.com/gravitational/teleport/lib/sshutils/scp"
 )
 
 // Options control aspects of a file transfer
@@ -664,7 +664,7 @@ func getAtime(fi os.FileInfo) time.Time {
         return time.Unix(int64(sftpfi.Atime), 0)
     }
 
-    return scp.GetAtime(fi)
+    return fi.ModTime()
 }
 
 // NewProgressBar returns a new progress bar that writes to writer.
--- lib/utils/disk.go.orig    2025-02-28 20:13:31 UTC
+++ lib/utils/disk.go
@@ -22,12 +22,12 @@
 package utils
 
 import (
-    "errors"
-    "io/fs"
-    "os"
-    "os/user"
-    "path/filepath"
-    "strconv"
+
+
+
+
+
+
     "syscall"
 
     "github.com/gravitational/trace"
@@ -68,75 +68,12 @@ func FreeDiskWithReserve(dir string, reservedFreeDisk
 // as it's not bullet proof and can report wrong results.
 func CanUserWriteTo(path string) (bool, error) {
     // prevent infinite loops with a max dir depth
-    var fileInfo os.FileInfo
-    var err error
 
-    for i := 0; i < 20; i++ {
-        fileInfo, err = os.Stat(path)
-        if err == nil {
-            break
-        }
-        if errors.Is(err, fs.ErrNotExist) {
-            path = filepath.Dir(path)
-            continue
-        }
 
-        return false, trace.BadParameter("failed to find path: %+v", err)
 
-    }
 
-    var uid int
-    var gid int
-    if stat, ok := fileInfo.Sys().(*syscall.Stat_t); ok {
-        uid = int(stat.Uid)
-        gid = int(stat.Gid)
-    }
 
-    var usr *user.User
-    if ogUser := os.Getenv("SUDO_USER"); ogUser != "" {
-        usr, err = user.Lookup(ogUser)
-        if err != nil {
-            return false, trace.NotFound("could not determine original user: %+v", err)
-        }
-    } else {
-        usr, err = user.Current()
-        if err != nil {
-            return false, trace.NotFound("could not determine current user: %+v", err)
-        }
-    }
 
-    perm := fileInfo.Mode().Perm()
 
-    // file is owned by the user
-    if strconv.Itoa(uid) == usr.Uid {
-        // file has u+wx permissions
-        if perm&syscall.S_IWUSR != 0 &&
-            perm&syscall.S_IXUSR != 0 {
-            return true, nil
-        }
-    }
-
-    // file and user have a group in common
-    groupIDs, err := usr.GroupIds()
-    if err != nil {
-        return false, trace.NotFound("could not determine current user group ids: %+v", err)
-    }
-    for _, groupID := range groupIDs {
-        if strconv.Itoa(gid) == groupID {
-            // file has g+wx permissions
-            if perm&syscall.S_IWGRP != 0 &&
-                perm&syscall.S_IXGRP != 0 {
-                return true, nil
-            }
-            break
-        }
-    }
-
-    // file has o+wx permissions
-    if perm&syscall.S_IWOTH != 0 &&
-        perm&syscall.S_IXOTH != 0 {
-        return true, nil
-    }
-
-    return false, nil
+    return true, nil
 }


Code:
make build
===>  Building for gravitational-teleport-17.3.0
(cd /usr/ports/shells/teleport/work/teleport-17.3.0;  for t in ./tool/tsh; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/teleport/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^teleport$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env -i HOME=/usr/ports/shells/teleport/work  MACHINE_ARCH=amd64  PWD="${PWD}"  GIT_CEILING_DIRECTORIES=/usr/ports/shells/teleport/work  __MAKE_CONF=/nonexistent OSVERSION=1304000 PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin TERM=xterm-256color XDG_DATA_HOME=/usr/ports/shells/teleport/work  XDG_CONFIG_HOME=/usr/ports/shells/teleport/work  XDG_CACHE_HOME=/usr/ports/shells/teleport/work/.cache  HOME=/usr/ports/shells/teleport/work PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin PKG_CONFIG_LIBDIR=/usr/ports/shells/teleport/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing  " BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" CGO_ENABLED=1  CGO_CFLAGS="-I/usr/local/include"  CGO_LDFLAGS="-L/usr/local/lib"  GOAMD64=  GOARM=  GOTMPDIR="/usr/ports/shells/teleport/work" GOPATH="/usr/ports/distfiles/go/shells_teleport"  GOBIN="/usr/ports/shells/teleport/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GOMAXPROCS=6 GOPROXY=off /usr/local/bin/go123 build -buildmode=exe -v -trimpath -ldflags=-s -buildvcs=false -mod=vendor  -o /usr/ports/shells/teleport/work/bin/${out}  ${pkg};  done)
===>  Building tsh from ./tool/tsh
github.com/gravitational/teleport/lib/sshutils/scp
# github.com/gravitational/teleport/lib/sshutils/scp
lib/sshutils/scp/local.go:107:15: undefined: GetAtime
*** Error code 1

Stop.
make: stopped in /usr/ports/shells/teleport

make build
===>  Building for gravitational-teleport-17.3.0
(cd /usr/ports/shells/teleport/work/teleport-17.3.0;  for t in ./tool/tsh; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/teleport/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^teleport$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env -i HOME=/usr/ports/shells/teleport/work  MACHINE_ARCH=amd64  PWD="${PWD}"  GIT_CEILING_DIRECTORIES=/usr/ports/shells/teleport/work  __MAKE_CONF=/nonexistent OSVERSION=1304000 PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin TERM=xterm-256color XDG_DATA_HOME=/usr/ports/shells/teleport/work  XDG_CONFIG_HOME=/usr/ports/shells/teleport/work  XDG_CACHE_HOME=/usr/ports/shells/teleport/work/.cache  HOME=/usr/ports/shells/teleport/work PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin PKG_CONFIG_LIBDIR=/usr/ports/shells/teleport/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing  " BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" CGO_ENABLED=1  CGO_CFLAGS="-I/usr/local/include"  CGO_LDFLAGS="-L/usr/local/lib"  GOAMD64=  GOARM=  GOTMPDIR="/usr/ports/shells/teleport/work" GOPATH="/usr/ports/distfiles/go/shells_teleport"  GOBIN="/usr/ports/shells/teleport/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GOMAXPROCS=6 GOPROXY=off /usr/local/bin/go123 build -buildmode=exe -v -trimpath -ldflags=-s -buildvcs=false -mod=vendor  -o /usr/ports/shells/teleport/work/bin/${out}  ${pkg};  done)
===>  Building tsh from ./tool/tsh
github.com/gravitational/teleport/lib/sshutils/scp
# github.com/gravitational/teleport/lib/sshutils/scp
lib/sshutils/scp/local.go:107:15: time.Time (type) is not an expression
*** Error code 1

Stop.
make: stopped in /usr/ports/shells/teleport

make build
===>  Building for gravitational-teleport-17.3.0
(cd /usr/ports/shells/teleport/work/teleport-17.3.0;  for t in ./tool/tsh; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/teleport/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^teleport$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env -i HOME=/usr/ports/shells/teleport/work  MACHINE_ARCH=amd64  PWD="${PWD}"  GIT_CEILING_DIRECTORIES=/usr/ports/shells/teleport/work  __MAKE_CONF=/nonexistent OSVERSION=1304000 PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin TERM=xterm-256color XDG_DATA_HOME=/usr/ports/shells/teleport/work  XDG_CONFIG_HOME=/usr/ports/shells/teleport/work  XDG_CACHE_HOME=/usr/ports/shells/teleport/work/.cache  HOME=/usr/ports/shells/teleport/work PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin PKG_CONFIG_LIBDIR=/usr/ports/shells/teleport/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing  " BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" CGO_ENABLED=1  CGO_CFLAGS="-I/usr/local/include"  CGO_LDFLAGS="-L/usr/local/lib"  GOAMD64=  GOARM=  GOTMPDIR="/usr/ports/shells/teleport/work" GOPATH="/usr/ports/distfiles/go/shells_teleport"  GOBIN="/usr/ports/shells/teleport/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GOMAXPROCS=6 GOPROXY=off /usr/local/bin/go123 build -buildmode=exe -v -trimpath -ldflags=-s -buildvcs=false -mod=vendor  -o /usr/ports/shells/teleport/work/bin/${out}  ${pkg};  done)
===>  Building tsh from ./tool/tsh
github.com/gravitational/teleport/lib/sshutils/scp
# github.com/gravitational/teleport/lib/sshutils/scp
lib/sshutils/scp/local.go:107:15: undefined: ModTime
*** Error code 1

Stop.
make: stopped in /usr/ports/shells/teleport

make build
===>  Building for gravitational-teleport-17.3.0
(cd /usr/ports/shells/teleport/work/teleport-17.3.0;  for t in ./tool/tsh; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/teleport/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^teleport$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env -i HOME=/usr/ports/shells/teleport/work  MACHINE_ARCH=amd64  PWD="${PWD}"  GIT_CEILING_DIRECTORIES=/usr/ports/shells/teleport/work  __MAKE_CONF=/nonexistent OSVERSION=1304000 PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin TERM=xterm-256color XDG_DATA_HOME=/usr/ports/shells/teleport/work  XDG_CONFIG_HOME=/usr/ports/shells/teleport/work  XDG_CACHE_HOME=/usr/ports/shells/teleport/work/.cache  HOME=/usr/ports/shells/teleport/work PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin PKG_CONFIG_LIBDIR=/usr/ports/shells/teleport/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing  " BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" CGO_ENABLED=1  CGO_CFLAGS="-I/usr/local/include"  CGO_LDFLAGS="-L/usr/local/lib"  GOAMD64=  GOARM=  GOTMPDIR="/usr/ports/shells/teleport/work" GOPATH="/usr/ports/distfiles/go/shells_teleport"  GOBIN="/usr/ports/shells/teleport/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GOMAXPROCS=6 GOPROXY=off /usr/local/bin/go123 build -buildmode=exe -v -trimpath -ldflags=-s -buildvcs=false -mod=vendor  -o /usr/ports/shells/teleport/work/bin/${out}  ${pkg};  done)
===>  Building tsh from ./tool/tsh
github.com/gravitational/teleport/lib/sshutils/scp
github.com/gravitational/teleport/lib/sshutils/sftp
# github.com/gravitational/teleport/lib/sshutils/sftp
lib/sshutils/sftp/sftp.go:667:13: undefined: scp.GetAtime
*** Error code 1

Stop.
make: stopped in /usr/ports/shells/teleport

make build
===>  Building for gravitational-teleport-17.3.0
(cd /usr/ports/shells/teleport/work/teleport-17.3.0;  for t in ./tool/tsh; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/teleport/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^teleport$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env -i HOME=/usr/ports/shells/teleport/work  MACHINE_ARCH=amd64  PWD="${PWD}"  GIT_CEILING_DIRECTORIES=/usr/ports/shells/teleport/work  __MAKE_CONF=/nonexistent OSVERSION=1304000 PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin TERM=xterm-256color XDG_DATA_HOME=/usr/ports/shells/teleport/work  XDG_CONFIG_HOME=/usr/ports/shells/teleport/work  XDG_CACHE_HOME=/usr/ports/shells/teleport/work/.cache  HOME=/usr/ports/shells/teleport/work PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin PKG_CONFIG_LIBDIR=/usr/ports/shells/teleport/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing  " BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" CGO_ENABLED=1  CGO_CFLAGS="-I/usr/local/include"  CGO_LDFLAGS="-L/usr/local/lib"  GOAMD64=  GOARM=  GOTMPDIR="/usr/ports/shells/teleport/work" GOPATH="/usr/ports/distfiles/go/shells_teleport"  GOBIN="/usr/ports/shells/teleport/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GOMAXPROCS=6 GOPROXY=off /usr/local/bin/go123 build -buildmode=exe -v -trimpath -ldflags=-s -buildvcs=false -mod=vendor  -o /usr/ports/shells/teleport/work/bin/${out}  ${pkg};  done)
===>  Building tsh from ./tool/tsh
github.com/gravitational/teleport/lib/sshutils/sftp
# github.com/gravitational/teleport/lib/sshutils/sftp
lib/sshutils/sftp/sftp.go:45:2: "github.com/gravitational/teleport/lib/sshutils/scp" imported and not used
*** Error code 1

Stop.
make: stopped in /usr/ports/shells/teleport

make build
===>  Building for gravitational-teleport-17.3.0
(cd /usr/ports/shells/teleport/work/teleport-17.3.0;  for t in ./tool/tsh; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/teleport/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^teleport$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env -i HOME=/usr/ports/shells/teleport/work  MACHINE_ARCH=amd64  PWD="${PWD}"  GIT_CEILING_DIRECTORIES=/usr/ports/shells/teleport/work  __MAKE_CONF=/nonexistent OSVERSION=1304000 PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin TERM=xterm-256color XDG_DATA_HOME=/usr/ports/shells/teleport/work  XDG_CONFIG_HOME=/usr/ports/shells/teleport/work  XDG_CACHE_HOME=/usr/ports/shells/teleport/work/.cache  HOME=/usr/ports/shells/teleport/work PATH=/usr/ports/shells/teleport/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/daniel/bin PKG_CONFIG_LIBDIR=/usr/ports/shells/teleport/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing  " BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" CGO_ENABLED=1  CGO_CFLAGS="-I/usr/local/include"  CGO_LDFLAGS="-L/usr/local/lib"  GOAMD64=  GOARM=  GOTMPDIR="/usr/ports/shells/teleport/work" GOPATH="/usr/ports/distfiles/go/shells_teleport"  GOBIN="/usr/ports/shells/teleport/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GOMAXPROCS=6 GOPROXY=off /usr/local/bin/go123 build -buildmode=exe -v -trimpath -ldflags=-s -buildvcs=false -mod=vendor  -o /usr/ports/shells/teleport/work/bin/${out}  ${pkg};  done)
===>  Building tsh from ./tool/tsh
github.com/gravitational/teleport/lib/sshutils/sftp
github.com/gravitational/teleport/lib/client
github.com/gravitational/teleport/lib/web/terminal
github.com/gravitational/teleport/lib/client/clientcache
github.com/gravitational/teleport/lib/client/db/oracle
github.com/gravitational/teleport/lib/kube/kubeconfig
github.com/gravitational/teleport/lib/web/mfajson
github.com/gravitational/teleport/lib/client/kube
github.com/gravitational/teleport/lib/vnet
github.com/gravitational/teleport/lib/srv/desktop/tdp
github.com/gravitational/teleport/lib/benchmark
github.com/gravitational/teleport/lib/client/identityfile
github.com/gravitational/teleport/lib/teleterm/gateway
github.com/gravitational/teleport/lib/client/db
github.com/gravitational/teleport/lib/benchmark/db
github.com/gravitational/teleport/lib/client/db/dbcmd
github.com/gravitational/teleport/lib/teleterm/clusters
github.com/gravitational/teleport/lib/teleterm/cmd
github.com/gravitational/teleport/lib/teleterm/services/connectmycomputer
github.com/gravitational/teleport/lib/teleterm/services/unifiedresources
github.com/gravitational/teleport/lib/teleterm/daemon
github.com/gravitational/teleport/lib/teleterm/vnet
github.com/gravitational/teleport/lib/teleterm/apiserver/handler
github.com/gravitational/teleport/lib/teleterm/apiserver
github.com/gravitational/teleport/lib/teleterm
github.com/gravitational/teleport/tool/tsh/common
github.com/gravitational/teleport/tool/tsh
 
Unless someone on the internet had the exact same problem, AI "suggestions" are worthless.
Hehe, I've had some pretty good results with other "unique' problems. While the AI doesn't give the exact correct answer, it does help me eventually arrive at it.
 
I'll leave it here for now and revisit polishing this and maybe fixing the patches to be less hacky later.


If anyone knows what's going on with the api/go.mod: no such file or directory error, I'd appreciate the help.
 
While the AI doesn't give the exact correct answer
So will Google. Sorry to go off topic but I see so many people on StackOverflow (where I was a mod) state, "I tried AI but that answer didn't work...", that every time someone mentions it I get twitchy fingers.
 
Back
Top