首页 > 其他分享 >Greenlight - Directory Structure

Greenlight - Directory Structure

时间:2024-11-14 08:50:02浏览次数:1  
标签:code will directory internal Greenlight contain Directory our Structure

 

$ mkdir -p bin cmd/api internal migrations remote
$ touch Makefile
$ touch cmd/api/main.go

At this point your project directory should look exactly like this:

greenlight
├── bin
├── cmd
│   └── api
│       └── main.go
├── internal
├── migrations
├── remote
├── go.mod
└── Makefile
  • The bin directory will contain our compiled application binaries, ready for deployment to a production server.
  • The cmd/api directory will contain the application-specific code for our Greenlight API application. This will include the code for running the server, reading and writing HTTP requests, and managing authentication.
  • The internal directory will contain various ancillary packages used by our API. It will contain the code for interacting with our database, doing data validation, sending emails and so on. Basically, any code which isn’t application-specific and can potentially be reused will live in here. Our Go code under cmd/api will import the packages in the internal directory (but never the other way around).
  • The migrations directory will contain the SQL migration files for our database.
  • The remote directory will contain the configuration files and setup scripts for our production server.
  • The go.mod file will declare our project dependencies, versions and module path.
  • The Makefile will contain recipes for automating common administrative tasks — like auditing our Go code, building binaries, and executing database migrations.

It’s important to point out that the directory name internal carries a special meaning and behavior in Go: any packages which live under this directory can only be imported by code inside the parent of the internal directory. In our case, this means that any packages which live in internal can only be imported by code inside our greenlight project directory.

Or, looking at it the other way, this means that any packages under internal cannot be imported by code outside of our project.

This is useful because it prevents other codebases from importing and relying on the (potentially unversioned and unsupported) packages in our internal directory — even if the project code is publicly available somewhere like GitHub.

标签:code,will,directory,internal,Greenlight,contain,Directory,our,Structure
From: https://www.cnblogs.com/zhangzhihui/p/18545220

相关文章

  • Greenlight - Endpoints and Actions
    MethodURLPatternActionGET/v1/healthcheckShowapplicationhealthandversioninformationGET/v1/moviesShowthedetailsofallmoviesPOST/v1/moviesCreateanewmovieGET/v1/movies/:idShowthedetailsofaspecificmoviePA......
  • 在Active Directory(AD)域控环境下,推送安装软件并实现静默安装,通常有几种方法可以实现。
    在ActiveDirectory(AD)域控环境下,推送安装软件并实现静默安装,通常有几种方法可以实现。根据你的需求,这里介绍几种常见的方式,它们支持EXE、MSI等多种安装包格式,并且可以实现静默安装。1. 组策略(GroupPolicy)部署组策略是AD域环境中部署软件的一种常见方式。它特别适合MSI安装包。......
  • Repadmin 是一个由 Microsoft 提供的命令行工具,用于诊断和管理 Active Directory 域控
    Repadmin|MicrosoftLearnRepadmin是一个由Microsoft提供的命令行工具,用于诊断和管理ActiveDirectory域控制器间的复制问题。它最初是在Windows2000Server时期随ActiveDirectory服务一起推出的,并随着WindowsServer版本的更新不断增强和改进。其主要功能是帮助......
  • 【THM】Active Directory Basics【未完成】
    本文相关房间连接https://tryhackme.com/r/room/winadbasicsintroduction介绍Microsoft’sActiveDirectoryisthebackboneofthecorporateworld.Itsimplifiesthemanagementofdevicesanduserswithinacorporateenvironment.Inthisroom,we’lltake......
  • 解决R报错: fatal error: hb-ft.h: No such file or directory 下载textshaping时
    >下载textshaping包,出现路径依赖错误。#解决路径依赖问题```condainstall-cconda-forgeharfbuzzfreetypefribidipkg-configwhichpkg-config  #看是否返回路径,返回即正常find/-name"harfbuzz.pc"2>/dev/nullfind/-name"freetype2.pc"2>/dev/nullfi......
  • 《基础设施、政策与发展杂志》-外文期刊征稿 Journal of Infrastructure, Policy and
    @目录一、会议详情二、重要信息三、大会介绍四、出席嘉宾五、征稿主题一、会议详情二、重要信息大会官网:https://ais.cn/u/vEbMBz三、大会介绍《基础设施、政策与发展杂志》(JIPD)是一本多学科、双盲同行评审期刊,致力于发表有关基础设施、经济发展和公共政策的高质量文章。......
  • clean-java-project-structure-实现秒杀系统
    clean-java-project-structure-意在clean&standard断WAN手撕了一个平平无奇的秒杀系统,crud过载,赶紧多看看源码缓缓秒杀系统实现-前言在互联网高速发展的时代,电商平台的各种促销活动层出不穷,其中“秒杀”活动以其低价、限时、限量的特点吸引了大量用户,成为电商平台吸......
  • Windows Active Directory技术介绍和应用——集中式用户账户管理
    大纲静态IP构建组织用户加域修改DNS加域题外参考资料企业可以将所有员工的账户信息集中存储在ActiveDirectory中,方便管理员进行统一创建、修改、删除用户账号等操作。例如,当新员工入职时,管理员可以快速创建其账号并赋予相应的权限和访问级别;员工离职时,也能及时禁......
  • Windows Active Directory技术介绍和应用——删除计算机对象
    大纲问题描述操作方案题外参考资料问题描述当我们配置ActiveDirectory时,往往会遇到部分机器需要重新加入域的场景。而这种情况下,可能会收到如下的报错。Thejoinoperationwasnotsuccessful.Thiscouldbebecauseanexistingcomputeraccounthavingname......
  • [水一篇] Structured Text(ST)
    StructuredText(ST),aprogramminglanguageusedinProgrammableLogicControllers(PLCs).StructuredTextisahigh-levellanguagethat'swidelyusedinindustrialautomationandcontrolsystems.It'satext-basedlanguagethatallowsprogramm......