Skip to content

Error "cannot use s.Rdev (type int32) as type uint64 in argument to major" on MacOS #34726

@ndrewnee

Description

@ndrewnee

Description
Hi, I found that after this commit I cannot build package github.com/moby/moby/pkg/archive on MacOS. On line

hdr.Devmajor = int64(major(s.Rdev))
was removed type conversion of s.Rdev to uint64. It works great on Linux because s.Rdev is uint64 on it, but on MacOS s.Rdev has type int32. See https://golang.org/src/syscall/ztypes_darwin_arm64.go#72

Steps to reproduce the issue:

  1. Go to pkg/archive
  2. Run go build

Describe the results you received:

./archive_unix.go:53:32: cannot use s.Rdev (type int32) as type uint64 in argument to major
./archive_unix.go:54:32: cannot use s.Rdev (type int32) as type uint64 in argument to minor

My environment

uname -a
Darwin Andrews-MacBook-Air.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ndrewnee/Projects/go"
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0g/wm4dp9t56wl8x87qv51k0xnr0000gn/T/go-build843481590=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions