mirror of
https://github.com/go-task/task.git
synced 2026-06-25 05:35:56 +00:00
23 lines
29 KiB
HTML
23 lines
29 KiB
HTML
<!doctype html>
|
||
<html lang="zh-Hans" dir="ltr" class="docs-wrapper docs-doc-page docs-version-current plugin-docs plugin-id-default docs-doc-id-contributing">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="generator" content="Docusaurus v2.3.1">
|
||
<title data-rh="true">贡献 | Task</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://taskfile.dev/zh-Hans/contributing/"><meta data-rh="true" name="docusaurus_locale" content="zh-Hans"><meta data-rh="true" name="docsearch:language" content="zh-Hans"><meta data-rh="true" name="og:image" content="https://taskfile.dev/img/og-image.png"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="贡献 | Task"><meta data-rh="true" name="description" content="非常欢迎对 Task 的贡献,但我们要求您在提交 PR 之前阅读本文档。"><meta data-rh="true" property="og:description" content="非常欢迎对 Task 的贡献,但我们要求您在提交 PR 之前阅读本文档。"><link data-rh="true" rel="icon" href="/zh-Hans/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://taskfile.dev/zh-Hans/contributing/"><link data-rh="true" rel="alternate" href="https://taskfile.dev/contributing/" hreflang="en-US"><link data-rh="true" rel="alternate" href="https://taskfile.dev/zh-Hans/contributing/" hreflang="zh-Hans"><link data-rh="true" rel="alternate" href="https://taskfile.dev/contributing/" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://7IZIJ13AI7-dsn.algolia.net" crossorigin="anonymous"><link rel="preconnect" href="https://www.google-analytics.com">
|
||
<link rel="preconnect" href="https://www.googletagmanager.com">
|
||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-4RT25NXQ7N"></script>
|
||
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-4RT25NXQ7N",{anonymize_ip:!0})</script>
|
||
|
||
|
||
<link rel="search" type="application/opensearchdescription+xml" title="Task" href="/zh-Hans/opensearch.xml"><link rel="stylesheet" href="/zh-Hans/assets/css/styles.fbd3cd80.css">
|
||
<link rel="preload" href="/zh-Hans/assets/js/runtime~main.a86bcaa2.js" as="script">
|
||
<link rel="preload" href="/zh-Hans/assets/js/main.ff3b4cee.js" as="script">
|
||
</head>
|
||
<body class="navigation-with-keyboard">
|
||
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
|
||
<div role="region" aria-label="跳到主要内容"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">跳到主要内容</a></div><nav aria-label="主导航" class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="切换导航栏" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/zh-Hans/"><div class="navbar__logo"><img src="/zh-Hans/img/logo.svg" alt="Task Logo" class="themedImage_ToTc themedImage--light_HNdA"><img src="/zh-Hans/img/logo.svg" alt="Task Logo" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Task</b></a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/zh-Hans/installation/">安装</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/zh-Hans/usage/">使用指南</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/zh-Hans/api/">接口</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/zh-Hans/donate/">赞助</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link"><svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" class="iconLanguage_nlXk"><path fill="currentColor" d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path></svg>简体中文</a><ul class="dropdown__menu"><li><a href="/contributing/" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="en-US">English</a></li><li><a href="/zh-Hans/contributing/" target="_self" rel="noopener noreferrer" class="dropdown__link dropdown__link--active" lang="zh-Hans">简体中文</a></li><li><a class="dropdown__link" href="/zh-Hans/translate/">Help Us Translate</a></li></ul></div></div><div class="navbar__items navbar__items--right"><a href="https://github.com/go-task/task" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://twitter.com/taskfiledev" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Twitter<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://fosstodon.org/@task" target="_blank" rel="me" class="navbar__item navbar__link">Mastodon<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.gg/6TY36E39UK" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="toggle_vylO colorModeToggle_DEke"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="切换浅色/暗黑模式(当前为浅色模式)" aria-label="切换浅色/暗黑模式(当前为浅色模式)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="搜索"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">搜索</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="回到顶部" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="文档侧边栏" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/">主页</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/installation/">安装</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/usage/">使用指南</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/api/">API 参考</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/integrations/">集成</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/faq/">常见问题</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/styleguide/">风格指南</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/changelog/">更新日志</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/community/">社区</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/zh-Hans/contributing/">贡献</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/releasing/">发布</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/taskfile-versions/">Taskfile 版本</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/donate/">赞助</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh-Hans/translate/">翻译</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a href="https://task-zh.readthedocs.io/zh_CN/latest/" target="_blank" rel="noopener noreferrer" class="menu__link menuExternalLink_NmtK">Chinese | 中国人<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></nav></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="页面路径"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="主页面" class="breadcrumbs__link" href="/zh-Hans/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">贡献</span><meta itemprop="position" content="1"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">本页总览</button></div><div class="theme-doc-markdown markdown"><h1>贡献</h1><p>非常欢迎对 Task 的贡献,但我们要求您在提交 PR 之前阅读本文档。</p><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>备注</div><div class="admonitionContent_S0QG"><p>This document applies to the core <a href="https://github.com/go-task/task" target="_blank" rel="noopener noreferrer">Task</a> repository <em>and</em> <a href="https://github.com/go-task/vscode-task" target="_blank" rel="noopener noreferrer">Task for Visual Studio Code</a>.</p></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="开始之前">开始之前<a href="#开始之前" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h2><ul><li><strong>检查已有工作</strong> - 是否已经存在 PR? 是否存在 Issue 正在讨论您要进行的功能/更改? 请确保你的工作中确实考虑了这些相关的讨论内容。</li><li><strong>向后兼容</strong> - 你的变更是否破坏了已经存在的 Taskfile? 向后兼容的变更会更容易被合并进去。 您是否可以采取一种方法来保持这种兼容性? 如果没有,请考虑先提出一个 Issue,以便在您投入时间进行 PR 之前讨论 API 的更改。</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="1-设置">1. 设置<a href="#1-设置" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h2><ul><li><strong>Go</strong> - Task is written in <a href="https://go.dev" target="_blank" rel="noopener noreferrer">Go</a>. 我们始终支持最新的两个主要 Go 版本,因此请确保您的版本足够新。</li><li><strong>Node.js</strong> - <a href="https://nodejs.org/en/" target="_blank" rel="noopener noreferrer">Node.js</a> is used to host Task's documentation server and is required if you want to run this server locally. It is also required if you want to contribute to the Visual Studio Code extension.</li><li><strong>Yarn</strong> - <a href="https://yarnpkg.com/" target="_blank" rel="noopener noreferrer">Yarn</a> is the Node.js package manager used by Task.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="2-进行变更">2. 进行变更<a href="#2-进行变更" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h2><ul><li><strong>Code style</strong> - Try to maintain the existing code style where possible. Go code should be formatted by <a href="https://github.com/mvdan/gofumpt" target="_blank" rel="noopener noreferrer"><code>gofumpt</code></a> and linted using <a href="https://golangci-lint.run" target="_blank" rel="noopener noreferrer"><code>golangci-lint</code></a>. Any Markdown or TypeScript files should be formatted and linted by <a href="https://prettier.io" target="_blank" rel="noopener noreferrer">Prettier</a>. This style is enforced by our CI to ensure that we have a consistent style across the project. You can use the <code>task lint</code> command to lint the code locally and the <code>task lint:fix</code> command to automatically fix any issues that are found.</li><li><strong>文档</strong> - 确保添加/更新了相关文档。 请参阅下面的 <a href="#%E6%9B%B4%E6%96%B0%E6%96%87%E6%A1%A3">更新文档</a> 部分。</li><li><strong>测试</strong> - 确保添加/更新了相关测试,并且在提交 PR 前已通过所有测试。 请参阅下面的 <a href="#%E7%BC%96%E5%86%99%E6%B5%8B%E8%AF%95">编写测试</a> 部分。</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="运行您的变更">运行您的变更<a href="#运行您的变更" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h3><p>要运行带有工作变更的任务,您可以使用 <code>go run ./cmd/task</code>。 要针对 <code>testdata</code> 中的测试任务文件运行任务的开发构建,您可以使用 <code>go
|
||
run ./cmd/task --dir ./testdata/<my_test_dir> <task_name></code>。</p><p>To run Task for Visual Studio Code, you can open the project in VSCode and hit F5 (or whatever you debug keybind is set to). This will open a new VSCode window with the extension running. Debugging this way is recommended as it will allow you to set breakpoints and step through the code. Otherwise, you can run <code>task package</code> which will generate a <code>.vsix</code> file that can be used to manually install the extension.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="更新文档">更新文档<a href="#更新文档" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h3><p>Task uses <a href="https://docusaurus.io" target="_blank" rel="noopener noreferrer">Docusaurus</a> to host a documentation server. The code for this is located in the core Task repository. This can be setup and run locally by using <code>task docs</code> (requires <code>nodejs</code> & <code>yarn</code>). All content is written in Markdown and is located in the <code>docs/docs</code> directory. All Markdown documents should have an 80 character line wrap limit (enforced by Prettier).</p><p>进行变更时,请考虑是否有必要更改 <a href="/zh-Hans/usage/">使用指南</a>。 本文档包含有关如何使用任务功能的说明和示例。 如果您要添加新功能,请尝试找到合适的位置来添加新部分。 如果您要更新现有功能,请确保文档和所有示例都是最新的。 确保任何示例都遵循 <a href="/zh-Hans/styleguide/">Taskfile 风格指南</a>。</p><p>如果您添加了新字段、命令或标志,请确保将其添加到 <a href="/zh-Hans/api/">API 参考</a> 中。 New fields also need to be added to the <a href="https://github.com/go-task/task/blob/main/docs/static/schema.json" target="_blank" rel="noopener noreferrer">JSON Schema</a>. API 参考和 schema 中的字段描述应该匹配。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="编写测试">编写测试<a href="#编写测试" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h3><p>A lot of Task's tests are held in the <code>task_test.go</code> file in the project root and this is where you'll most likely want to add new ones too. Most of these tests also have a subdirectory in the <code>testdata</code> directory where any Taskfiles/data required to run the tests are stored.</p><p>进行更改时,请考虑是否需要添加新的测试。 这些测试应确保您添加的功能在未来持续工作。 如果您更改了 Task 的行为,则现有测试也可能需要更新。</p><p>You may also consider adding unit tests for any new functions you have added. The unit tests should follow the Go convention of being location in a file named <code>*_test.go</code> in the same package as the code being tested.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="3-提交代码">3. 提交代码<a href="#3-提交代码" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h2><p>尝试编写有意义的提交消息并避免在 PR 上有太多提交。 大多数 PR 应该有一个单一的提交(尽管对于更大的 PR 将它分成几个可能是合理的)。 Git squash 和 rebase 是你的好朋友!</p><p>If you're not sure how to format your commit message, check out <a href="https://www.conventionalcommits.org" target="_blank" rel="noopener noreferrer">Conventional Commits</a>. This style is not enforced, but it is a good way to make your commit messages more readable and consistent.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="4-提交-pr">4. 提交 PR<a href="#4-提交-pr" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h2><ul><li><strong>描述变更</strong> - 确保您提供对更改的全面描述。</li><li><strong>Issue/PR 链接</strong> - 链接到之前相关的 Issue 或 PR。 请描述当前工作与之前的不同之处。</li><li><strong>Examples</strong> - Add any examples or screenshots that you think are useful to demonstrate the effect of your changes.</li><li><strong>PR 草案</strong> - 如果变更还未完成,但您想讨论它们,请将 PR 作为草稿打开并添加评论以开始讨论。 使用评论而不是 PR 描述允许稍后更新描述,同时保留讨论。</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="常见问题">常见问题<a href="#常见问题" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h2><blockquote><p>我想贡献,我从哪里开始?</p></blockquote><p>Take a look at the list of <a href="https://github.com/go-task/task/issues" target="_blank" rel="noopener noreferrer">open issues for Task</a> or <a href="https://github.com/go-task/vscode-task/issues" target="_blank" rel="noopener noreferrer">Task for Visual Studio Code</a>. We have a <a href="https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22" target="_blank" rel="noopener noreferrer">good first issue</a> label for simpler issues that are ideal for first time contributions.</p><p>欢迎各种贡献,无论是拼写错误修复还是很小的新功能。 您还可以通过对 Issue 进行投票/评论、帮助回答问题或帮助 <a href="/zh-Hans/community/">其他社区项目</a> 来做出贡献。</p><blockquote><p>我被困住了,我在哪里可以获得帮助?</p></blockquote><p>If you have questions, feel free to ask them in the <code>#help</code> forum channel on our <a href="https://discord.gg/6TY36E39UK" target="_blank" rel="noopener noreferrer">Discord server</a> or open a <a href="https://github.com/go-task/task/discussions" target="_blank" rel="noopener noreferrer">Discussion</a> on GitHub.</p><hr></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="文档分页导航"><a class="pagination-nav__link pagination-nav__link--prev" href="/zh-Hans/community/"><div class="pagination-nav__sublabel">上一页</div><div class="pagination-nav__label">社区</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/zh-Hans/releasing/"><div class="pagination-nav__sublabel">下一页</div><div class="pagination-nav__label">发布</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#开始之前" class="table-of-contents__link toc-highlight">开始之前</a></li><li><a href="#1-设置" class="table-of-contents__link toc-highlight">1. 设置</a></li><li><a href="#2-进行变更" class="table-of-contents__link toc-highlight">2. 进行变更</a><ul><li><a href="#运行您的变更" class="table-of-contents__link toc-highlight">运行您的变更</a></li><li><a href="#更新文档" class="table-of-contents__link toc-highlight">更新文档</a></li><li><a href="#编写测试" class="table-of-contents__link toc-highlight">编写测试</a></li></ul></li><li><a href="#3-提交代码" class="table-of-contents__link toc-highlight">3. 提交代码</a></li><li><a href="#4-提交-pr" class="table-of-contents__link toc-highlight">4. 提交 PR</a></li><li><a href="#常见问题" class="table-of-contents__link toc-highlight">常见问题</a></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">页面</div><ul class="footer__items clean-list"><li class="footer__item"><a class="footer__link-item" href="/zh-Hans/installation/">安装</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-Hans/usage/">使用指南</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-Hans/donate/">赞助</a></li></ul></div><div class="col footer__col"><div class="footer__title">社区</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://github.com/go-task/task" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://twitter.com/taskfiledev" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://fosstodon.org/@task" target="_blank" rel="me" class="footer__link-item">Mastodon<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://discord.gg/6TY36E39UK" target="_blank" rel="noopener noreferrer" class="footer__link-item">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://opencollective.com/task" target="_blank" rel="noopener noreferrer" class="footer__link-item">OpenCollective<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="col footer__col"><div class="footer__title">翻译</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://task-zh.readthedocs.io/zh_CN/latest/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Chinese | 中国人<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div></div></footer></div>
|
||
<script src="/zh-Hans/assets/js/runtime~main.a86bcaa2.js"></script>
|
||
<script src="/zh-Hans/assets/js/main.ff3b4cee.js"></script>
|
||
</body>
|
||
</html> |