Open weienwong opened 5 years ago
go-libsass uses cgo. It's awful but the underlying compiler has been very challenging to rebuild in go. If you want to look at a pure Go compiler check out: https://github.com/wellington/sass
Anyways, your issue is that you need to compile the c code against linux libraries.
@weienwong I'm having the same issue. Did you find any workaround?
Quick update. I managed to build it using the following dockerfile:
FROM golang:1.12-alpine as builder
RUN apk add git gcc g++ libsass-dev
RUN mkdir -p /app
COPY . /app
WORKDIR /app
RUN CGO_ENABLED=1 GOOS=linux go build -ldflags "-linkmode external -extldflags -static"
I am running this on go version go1.11.1 darwin/amd64 on Mac OS High Sierra v.10.13.6
This is the code I am trying to run through
go build
When I compile the above file using
go build -tags dev
, I'm able to run the outputted binary. However when I runGOOS=linux go build
I receive the following error. We need the GOOS flag set to linux because the app is being deployed to a Linux Docker Image. There should not be any correlation between the struct
SassNumber
and the output OS.