# Building a Go Container

**URL:** <https://forums.suse.com/t/building-a-go-container/4513>\
**Category:** General\
**Created:** [November 2, 2016, 8:16am UTC](https://forums.suse.com/t/building-a-go-container/4513 "2016-11-02T08:16:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guido\_Steiner](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/guido_steiner/32/5862_2.png) [@Guido\_Steiner](https://forums.suse.com/u/Guido_Steiner)\
**Post date:** [November 2, 2016, 8:16am UTC](https://forums.suse.com/t/building-a-go-container/4513/1 "2016-11-02T08:16:38Z")

</div>

external-dns is currently not supporting PowerDNS4.0 so I wanted to fix this on my own…but I still try to figure out how to compile [https://github.com/rancher/external-dns](https://github.com/rancher/external-dns) this.

Anyone can help me here?

---

<div class="post-metadata">

**Author:** ![mathuin](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/mathuin/32/1391_2.png) [@mathuin](https://forums.suse.com/u/mathuin)\
**Post date:** [November 9, 2016, 3:30am UTC](https://forums.suse.com/t/building-a-go-container/4513/2 "2016-11-09T03:30:24Z")

</div>

Hello! I have successfully modified that package to support Digital Ocean. If you have any specific questions, please ask, and if I can help I will!

---

<div class="post-metadata">

**Author:** ![Guido\_Steiner](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/guido_steiner/32/5862_2.png) [@Guido\_Steiner](https://forums.suse.com/u/Guido_Steiner)\
**Post date:** [November 11, 2016, 9:50am UTC](https://forums.suse.com/t/building-a-go-container/4513/3 "2016-11-11T09:50:35Z")

</div>

Oh if you could tell me how to compile [https://github.com/rancher/external-dns](https://github.com/rancher/external-dns) this would be great. I strugle somehow with the setup.

---

<div class="post-metadata">

**Author:** ![mathuin](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/mathuin/32/1391_2.png) [@mathuin](https://forums.suse.com/u/mathuin)\
**Post date:** [November 11, 2016, 6:24pm UTC](https://forums.suse.com/t/building-a-go-container/4513/4 "2016-11-11T18:24:42Z")

</div>

I do not have a huge amount of experience in Go, and most of what I’ve done has been scratching my own itch.

This tool was written for Go 1.5.2 and used Godeps. I ripped out all the Godeps stuff and bumped up the version to 1.6 and that was fine. What was really frustrating was the absolute imports — every time it referenced itself via “[github.com/rancher/external-dns/something](http://github.com/rancher/external-dns/something)” I had to change that to my fork. I’m not completely sure that that import style is necessary, but my primary goal was to add functionality, not refactor. 🙂

I did do a little refactoring because I couldn’t quite figure out how to make something work after I broke it. I made the provider settable via an environment variable which helped me move forward. It _might_ have been related to the change in Go version.

If your goal is for personal use, feel free to fork mine at [github.com/mathuin/external-dns](http://github.com/mathuin/external-dns) and change all the references from mathuin to your Github name and you should be good to go!

I _think_ there’s still a bug in my implementation with respect to deleting records, I can’t recall. I should look at that sometime!

---

<div class="post-metadata">

**Author:** ![Guido\_Steiner](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/guido_steiner/32/5862_2.png) [@Guido\_Steiner](https://forums.suse.com/u/Guido_Steiner)\
**Post date:** [November 14, 2016, 12:59pm UTC](https://forums.suse.com/t/building-a-go-container/4513/5 "2016-11-14T12:59:49Z")

</div>

Hmm my problem was that i didn’t figure out how to clone the project so that I can compile the project.

---

<div class="post-metadata">

**Author:** ![mathuin](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/mathuin/32/1391_2.png) [@mathuin](https://forums.suse.com/u/mathuin)\
**Post date:** [November 14, 2016, 2:42pm UTC](https://forums.suse.com/t/building-a-go-container/4513/6 "2016-11-14T14:42:36Z")

</div>

Ah, that’s a different issue.

The project is on Github as you know. You need to run `git clone https://github.com/rancher/external-dns` on your own computer (that command line is generic, it might be different if you’re not on Linux). That will check out the source code to your system in a directory named `external-dns` in the directory where you executed that command. You will have to rearrange things and rename things as I mention above because of how Go works.

Good luck!

---

<div class="post-metadata">

**Author:** ![Guido\_Steiner](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/guido_steiner/32/5862_2.png) [@Guido\_Steiner](https://forums.suse.com/u/Guido_Steiner)\
**Post date:** [February 17, 2017, 1:51pm UTC](https://forums.suse.com/t/building-a-go-container/4513/7 "2017-02-17T13:51:51Z")

</div>

Damn…though I could forget this…but now it seam I have to fix this errors on my own.

So I install godeps from google and then how can i compile external-dns then?

regards  
Guido

---

<div class="post-metadata">

**Author:** ![mathuin](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/mathuin/32/1391_2.png) [@mathuin](https://forums.suse.com/u/mathuin)\
**Post date:** [February 17, 2017, 7:30pm UTC](https://forums.suse.com/t/building-a-go-container/4513/8 "2017-02-17T19:30:55Z")

</div>

I created a script called `buildme.sh` which I have in the top directory (~/go/src/github.com/rancher/external-dns here):

```
#!/bin/bash
./scripts/build
cd bin/
tar cf ../packaging/external-dns.tar external-dns
gzip -f9 ../packaging/external-dns.tar
docker build -t myregistry/mathuin/external-dns ../packaging
docker push myregistry/mathuin/external-dns

```

I had to change the packaging Dockerfile as well:

```
FROM alpine:3.2
MAINTAINER Rancher Labs, Inc.
RUN apk add --update ca-certificates

ENV EXT_DNS_RELEASE v0.6.1
#ADD https://github.com/rancher/external-dns/releases/download/${EXT_DNS_RELEASE}/external-dns.tar.gz /external-dns.tar.gz
COPY external-dns.tar.gz /external-dns.tar.gz
RUN tar -zxvf /external-dns.tar.gz -C /usr/bin

ENTRYPOINT ["/usr/bin/external-dns"]

```

The resulting artifact is a container which I run in my environment as part of an infrastructure stack.

Let me know if you have any questions!

Jack.
