From the course: Programming with Go Modules

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Adding module packages and source code

Adding module packages and source code - Go Tutorial

From the course: Programming with Go Modules

Adding module packages and source code

- [Instructor] In this video, we're going to add a new package to the module. This package will be the library package that implements the emoji search functionality. First, let's create our directory for our package. I'm already in the emoserve module directory, so I can just create the directory. All right, next we're going to add source code to the search package. So the first thing I'll do is a new file, and the first file we're going to add is the data source code. I'm going to copy and paste that. Okay, so let's go over the source code that you see in front of you. The first thing we do is we declare the package. Because we're part of the search package, it's package search. The next thing we have is the struct called emoji. This is the struct that represent the emoji data. And as you can see, we have the member Emoji, which is the actual emoji. We have labels, we have some tags we can use for the emoji, and sometime we have an emoticon for the emoji. The next variable in the…

Contents