Do coding in chromebook OS

Tl;dr: since I bought my Acer C720 Chromebook in mid-2017, I hardly ever did coding in that operating system. I did coding by install dual os with Ubuntu, so I use Ubuntu system to fulfill my coding crave.

But then I realize this way actually has the shortcoming. If I did some college task on my ChromeOS while did coding task, I had to switch between the OS, so I can’t see the other task. Another bad issue that I had been installing another OS to Chromebook is it uses the memory too much (almost 1 gb – 3 gb) every installation with the software packages included (if you have standard Chromebook with 16 gb storage, after installation from my experience my Chromebook will remain memory just 2 gb – 4 gb). So I have experience did install Ubuntu using crouton is more 10 times, because sometimes there have problems with my Ubuntu system or the memory is left less than 100 mb. So pathetic.

So the alternative way is asking a question, is there a way to do coding in my Chromebook OS?; The answer is yes, there is. Yesterday night I successfully install Chromebook packages for every developer that want to do coding on their ChromeOS. The packages are called Chromebrew, you could go to its source code to see the project on Github and the installation of the Chromebrew here.

From my perspective, it’s very helpful and astonishing projects, you could install every package you want in the development environment, if the package isn’t available, you can do by building the package itself in it’s Github source code.

Another important thing is you must pay attention to every successful message installation package because there’s sometimes you will give the advice to set the PATH Environment variable to your ChromeOS, and it is really confusing because for the first time is like quite different to the other distro Linux, but if you familiar with bash terminal and some file system hierarchy on Linux, you will end up with wisdom understand how to handle it.

Yes, I had a little problem that I must counter when I install Golang on my ChromeOS. First, I did install using Chromebrew package, by typing on the shell:

crew search go

it will give the result about some packages that have words “go” include golang. Here is the snippet what I was doing last night.

Then you can install go by typing:

crew install go

After I finished the installation, maybe because of I’m very excited I jump into my Text code editor and start coding hello world! program using golang like this:

package main
import "fmt"
 func main() {
 fmt.Printf("Hello, World!\n")
 }

and then I run it, by typing

go install hello
or
go run hello.go

voila! I get the trouble. The snippet problems I had was like this.

and

So why does that problem happen?. The answer was I get after almost 2 hours doing idle between hungry and spirit to tackle the problem. So the problems happened because I forget to set the variable environment path also the execute permissions for the file system. So to solve that, I firstly must set the environment variable, by type:

export PATH=$PATH:/usr/local/go/bin ## this is where you install golang, chromebrew actually put the go installation in usr/local/share/go.
export GOPATH=~/Downloads/gocode ## this is where you will keep your Go projects
export PATH=$PATH:$GOPATH/bin ##this adds both Go and your "installed" projects to PATH

After that, you must set the execute file permissions the drive as executable. Without this, you’ll get Permission denied trying to execute anything. By type:

sudo mount -i -o remount,exec /home/chronos/user/

If you want command go run to work you will also need to remount /tmp as executable. go run compiles into a temp folder then executes from there.

export TMPDIR=/usr/local/tmp

Alright, then you could restart the shell, type exit or close the terminal window then reopen with Ctrl+Alt+T and type shell.
Voila, the program is run!

Ah, actually I missed something important that I realize after successfully solve the issues, that golang sends me messages to set the variable after installation! What a shame for myself! haha


Alright, the last one I’ll give you some good references of what I was doing last night and if you want to build another good things, maybe this would be helpful.

Running Go on a Chromebook in Developer Mode (without installing Linux) by Danny Tuppeny
My two weeks programming on a Chromebook challenge by Sollarian Programmer
How to install/build/run go on chrome OS by golang