cli icon indicating copy to clipboard operation
cli copied to clipboard

fix: simplify scheduled functions template in go

Open karagulamos opened this issue 2 years ago • 2 comments

Summary

Related to https://github.com/netlify/pillar-runtime/issues/253

This PR aims to address the following issues when working with Go function templates:

  1. Inconsistency between regular and scheduled Go functions template
  2. netlify.toml file isn't in the current working directory (CWD) when the Go template is generated using functions:create. We should consider having a similar structure for go.mod and go.sum files. (The existing structure requires users to change their CWD to get this to work)
  3. Simplify netlify.toml configuration

With this fix, this is what the folder/file structure now looks like:

image

NOTE: Please feel free to nudge me in the right direction if there's a cleaner way to do this.

Test Plan

I have only made this letter longer because I have not had the time to make it shorter - Blaise Pascal

Unfortunately, I didn't write a test for this (:llama-ashamed:) but already confirmed that deployment (and scheduled functions) works without a user needing to change their CWD as with the existing scheduled function template.

https://app.netlify.com/sites/elated-blackwell-1b1c3d/deploys/62541423b956e20008d126d8 https://app.netlify.com/sites/elated-blackwell-1b1c3d/functions/scheduled-function

karagulamos avatar Apr 11 '22 13:04 karagulamos

📊 Benchmark results

Comparing with 62e64c471be5fc1068f719139559568a02db64f5

Package size: 380 MB

⬆️ 0.00% increase vs. 62e64c471be5fc1068f719139559568a02db64f5

^  380 MB  380 MB  380 MB  380 MB  380 MB  380 MB  380 MB  380 MB  380 MB  380 MB  380 MB  380 MB  380 MB 
│   ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend
  • T-30 (62e64c471be5fc1068f719139559568a02db64f5): 380 MB
  • T-29 (3840cc432267ef020ce324a4ebf1ada264082bdf): 380 MB
  • T-28 (0f69bb578fa3e1118657d33f7cfcff8035591d41): 380 MB
  • T-27 (ccd26a535e49a9b009b9a5670ce58682ac43368b): 380 MB
  • T-26 (68665492916e56ee41e953293087bc17a016567a): 380 MB
  • T-25 (6a16b6eb8d10236bf8c111993892516c38fbe7a1): 380 MB
  • T-24 (1fd0c2c3ce51457e52c8ab4fe922b6c4404917f1): 380 MB
  • T-23 (84fa9f67bcf9e147ec84c5030273b9fa5483a036): 380 MB
  • T-22 (e4f6ef01f7ddfd4312e7e25e05e1e84945aee5e7): 380 MB
  • T-21 (ec31485feea3b92775498719c194fd2f0682d075): 380 MB
  • T-20 (14d3714f06f8ca32f7554865ceef9d262e68a8c5): 380 MB
  • T-19 (0b40103f6d01f8ef6414ec5036f019bc57d30087): 380 MB
  • T-18 (4110a268eba4710ac200eac12fb2024a5987d88d): 380 MB
  • T-17 (d870da4d5393da6a00a690a21b8a6f0e5ec598b6): 380 MB
  • T-16 (fc702d09654d8a573eefb647243bce2c92011e7a): 380 MB
  • T-15 (e4010cbc0b72e95dd7379253fb3d1fb008475b3c): 380 MB
  • T-14 (a2bbaf07af096698062a867c3948479ac8f83bee): 380 MB
  • T-13 (5a8a33077a2825595795e87df72a6fc91e7578d2): 380 MB
  • T-12 (92d621b894704816665c79a7d97e8f65858e2bf7): 380 MB
  • T-11 (b9e9008a0cf725236178d8011255c34096a93caf): 380 MB
  • T-10 (17726b330cf8df14635cf4ae19387e1310849e7f): 380 MB
  • T-9 (9a1573b4d0d9a1837942412d6a558ef2ee7ec344): 380 MB
  • T-8 (24b253323f97c2ba0169596bf3cdb6834b79a29e): 380 MB
  • T-7 (16938246ac6ef41b1b30a8440f98d32199d9be8f): 380 MB
  • T-6 (3df8f95a1f92fef41dc5c43d79b99551cf6f2bad): 380 MB
  • T-5 (6e47ae1428128b0947a9ba0880033639d05b4651): 380 MB
  • T-4 (6ecc6ceac269dbcb4d92289ed6aa40dd04aab570): 380 MB
  • T-3 (337b969ee78115b6e1545405bdaf70074619c0b0): 380 MB
  • T-2 (3d5ed50b99e43d3efce7388c7534ac25206a276b): 380 MB
  • T-1 (acc9a65093d8ceaacb1b221bd283867b59a94ce0): 380 MB
  • T (current commit): 380 MB

github-actions[bot] avatar Apr 11 '22 13:04 github-actions[bot]

I've decided to convert the PR to a draft to allow me to rethink the approach. I'll probably revisit this when I have some free time.

karagulamos avatar Apr 11 '22 15:04 karagulamos