Intersection of Two Slice in Golang

package main

import "fmt"

func intersection(slice1, slice2 []string) (inter []string) {
    hash := make(map[string]bool)
    for _, e := range slice1 {
        hash[e] = true
    }
    for _, e := range slice2 {
        if hash[e] {
            inter = append(inter, e)
        }
    }
    inter = removeDups(inter)
    return
}

func removeDups(elements []string) (nodups []string) {
    encountered := make(map[string]bool)
    for _, element := range elements {
        if !encountered[element] {
            nodups = append(nodups, element)
            encountered[element] = true
        }
    }
    return
}

func main() {
    slice1 := []string{"java", "php", "mysql", "nilpointer.net", "golang"}
    slice2 := []string{"golang", "html", "php", "nilpointer.net"}
    fmt.Println(intersection(slice1, slice2))
}
        
[golang php nilpointer.net]