Skip to content

Commit

Permalink
Update Go shard to include gofmt (#132)
Browse files Browse the repository at this point in the history
* Update Go shard to include gofmt

* Add gofmt to the PATH

* Trim trailing whitespace
  • Loading branch information
omus authored Apr 9, 2021
1 parent d37e9c4 commit eb8ade8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Artifacts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2046,25 +2046,25 @@ os = "linux"

[["Go.v1.16.3.x86_64-linux-musl.squashfs"]]
arch = "x86_64"
git-tree-sha1 = "3a85d82c6b7bb04cc5fd9c206a40071a85a8ab33"
git-tree-sha1 = "3d6e4e251649e26ee915d1571e5a087fa82e80d1"
lazy = true
libc = "musl"
os = "linux"

[["Go.v1.16.3.x86_64-linux-musl.squashfs".download]]
sha256 = "3c51d29fc653f41c8e4a9fa52444deefc984e146426db7e87065ebb50a129a0a"
url = "https://github.com/JuliaPackaging/Yggdrasil/releases/download/Go-v1.16.3/Go.v1.16.3.x86_64-linux-musl.squashfs.tar.gz"
sha256 = "a618ec9032151f850febfd7df54d3ccd8298ed6400a9bd67c269f405a3c60c5b"
url = "https://github.com/JuliaPackaging/Yggdrasil/releases/download/Go-v1.16.3+0/Go.v1.16.3.x86_64-linux-musl.squashfs.tar.gz"

[["Go.v1.16.3.x86_64-linux-musl.unpacked"]]
arch = "x86_64"
git-tree-sha1 = "899505c8af5679696acf1b476a16b5696f5caf24"
git-tree-sha1 = "c339a184d3baa86ea328ad416eb06e7476f0aa21"
lazy = true
libc = "musl"
os = "linux"

[["Go.v1.16.3.x86_64-linux-musl.unpacked".download]]
sha256 = "a5b4ad9807ad4c16a8df91ebc763d75b766edeed12a83f2f608a38081f53e82e"
url = "https://github.com/JuliaPackaging/Yggdrasil/releases/download/Go-v1.16.3/Go.v1.16.3.x86_64-linux-musl.unpacked.tar.gz"
sha256 = "05b9524e7ce044da1b2384b6e92a33ec657e728d0d387819629600e334b09fef"
url = "https://github.com/JuliaPackaging/Yggdrasil/releases/download/Go-v1.16.3+0/Go.v1.16.3.x86_64-linux-musl.unpacked.tar.gz"

[["LLVMBootstrap.v11.0.1.x86_64-linux-musl.squashfs"]]
arch = "x86_64"
Expand Down
14 changes: 8 additions & 6 deletions src/Runner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,21 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
vrun \${CCACHE} $(prog) "\${PRE_FLAGS[@]}" "\${ARGS[@]}" "\${POST_FLAGS[@]}"
""")
end

# Helper invocations
target_tool(io::IO, tool::String, args...; kwargs...) = wrapper(io, "/opt/$(target)/bin/$(target)-$(tool)", args...; kwargs...)
llvm_tool(io::IO, tool::String, args...; kwargs...) = wrapper(io, "/opt/$(host_target)/bin/llvm-$(tool)", args...; kwargs...)

# For now this is required for Clang, since apple spells aarch64 as "arm64".
# Should probably be fixed upstream, but will do for now
clang_target_triplet(p::AbstractPlatform) = replace(aatriplet(p), "aarch64" => "arm64")

function clang_flags!(p::AbstractPlatform, flags::Vector{String} = String[])
# Focus the clang targeting laser
append!(flags, [
# Set the `target` for `clang` so it generates the right kind of code
"-target $(clang_target_triplet(p))",
# Set our sysroot to the platform-specific location, dropping compiler ABI annotations
# Set our sysroot to the platform-specific location, dropping compiler ABI annotations
"--sysroot=/opt/$(aatriplet(p))/$(aatriplet(p))/sys-root",
])
# For MacOS and FreeBSD, we don't set `-rtlib`, and FreeBSD is special-cased within the LLVM source tree
Expand Down Expand Up @@ -410,7 +410,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
end
end
fc(io::IO, p::AbstractPlatform) = gfortran(io, p)

# Go stuff where we build an environment mapping each time we invoke `go-${target}`
function GOOS(p::AbstractPlatform)
if os(p) == "macos"
Expand All @@ -437,6 +437,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
)
return wrapper(io, "/opt/$(host_target)/go/bin/go"; env=env, allow_ccache=false)
end
gofmt(io::IO, p::AbstractPlatform) = wrapper(io, "/opt/$(host_target)/go/bin/gofmt"; allow_ccache=false)

# Rust stuff
function rust_flags!(p::AbstractPlatform, flags::Vector{String} = String[])
Expand Down Expand Up @@ -549,7 +550,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
:strip, :install_name_tool, :dlltool, :windres, :winmc, :lipo)
@eval $(tool)(io::IO, p::AbstractPlatform) = $(wrapper)(io, string("/opt/", aatriplet(p), "/bin/", aatriplet(p), "-", $(string(tool))); allow_ccache=false)
end

# c++filt is hard to write in symbols
function cxxfilt(io::IO, p::AbstractPlatform)
if Sys.isapple(p)
Expand Down Expand Up @@ -645,6 +646,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
# Generate go stuff
if :go in compilers
write_wrapper(go, p, "$(t)-go")
write_wrapper(gofmt, p, "$(t)-gofmt")
end

# Misc. utilities
Expand Down Expand Up @@ -704,7 +706,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
append!(default_tools, ("rustc","rustup","cargo"))
end
if :go in compilers
append!(default_tools, ("go",))
append!(default_tools, ("go", "gofmt"))
end
# Create symlinks for default compiler invocations, invoke target toolchain
for tool in default_tools
Expand Down

0 comments on commit eb8ade8

Please sign in to comment.